app/Http/Controllers/ProjectController.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()
    {
        $data['projects']=project::where('user_id',auth()->user()->id)->get();
        if (auth()->user()->isAdmin()){
            $data['projects']=project::all();
        }
        return view('project.index',$data);
    }
public function index ( ) { $ data [ 'projects' ] = project :: where ( 'user_id' , auth ( ) -> user ( ) -> id ) -> get ( ) ; if ( auth ( ) -> user ( ) -> isAdmin ( ) ) { $ data [ 'projects' ] = project :: all ( ) ; } return view ( 'project.index' , $ data ) ; }
Display a listing of the resource.
Display a listing of the resource .