app/Http/Controllers/RequirementController.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()
    {
        $user = \Auth::user();
        if ($user->hasRole('supervisor') || $user->hasRole('super administrador')) {
            $requirements = Requirement::all();
            $total_requirements = $requirements->count();
        } elseif ($user->hasRole('analista')) {
            $requirements = $user->assignments;
            $total_requirements = $requirements->count();
        } elseif ($user->hasRole('usuario')) {
            $requirements = $user->requirements;
            $total_requirements = $requirements->count();
        }
        return view('requirements.show', [
            'user'                    => $user,
            'requirements'            => $requirements,
            'total_requirements'      => $total_requirements
        ]);
    }
public function index ( ) { $ user = \ Auth :: user ( ) ; if ( $ user -> hasRole ( 'supervisor' ) || $ user -> hasRole ( 'super administrador' ) ) { $ requirements = Requirement :: all ( ) ; $ total_requirements = $ requirements -> count ( ) ; } elseif ( $ user -> hasRole ( 'analista' ) ) { $ requirements = $ user -> assignments ; $ total_requirements = $ requirements -> count ( ) ; } elseif ( $ user -> hasRole ( 'usuario' ) ) { $ requirements = $ user -> requirements ; $ total_requirements = $ requirements -> count ( ) ; } return view ( 'requirements.show' , [ 'user' => $ user , 'requirements' => $ requirements , 'total_requirements' => $ total_requirements ] ) ; }
Display a listing of the resource.
Display a listing of the resource .