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