app/Http/Controllers/PlantillaController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        if (Auth::user()->hasRole('SuperAdministrador')) {
            $plantillas = Plantilla::where('empresa_id', 0)->orderBy('nombre')->get();
        } else {
            $plantillas = Plantilla::where('empresa_id', 0)->orWhere('empresa_id', Auth::user()->empresa_id)->orderBy('nombre')->get();
        }
        return view('plantilla.index', compact('plantillas'));
    }
public function index ( ) { if ( Auth :: user ( ) -> hasRole ( 'SuperAdministrador' ) ) { $ plantillas = Plantilla :: where ( 'empresa_id' , 0 ) -> orderBy ( 'nombre' ) -> get ( ) ; } else { $ plantillas = Plantilla :: where ( 'empresa_id' , 0 ) -> orWhere ( 'empresa_id' , Auth :: user ( ) -> empresa_id ) -> orderBy ( 'nombre' ) -> get ( ) ; } return view ( 'plantilla.index' , compact ( 'plantillas' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .