<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class CategoriaController extends Controller
{
    public function selectCategory(Request $request)
    {
        if(!$request->ajax()) return view('/');

        $categorias = DB::table('categorias')
                            ->select('id as categoria_id','tipo','estado')
                            ->where('estado','1')
                            ->orderBy('tipo','asc')
                            ->get();
        return response()->json($categorias);
    }
}
