app/Http/Controllers/Admin/PostController.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(Sentinel::inRole('administrator')) {
			 $posts = Post::orderBy('created_at', 'DESC')->paginate(10);
		} else {
			$user_id = Sentinel::getUser()->id;
			$posts = Post::where('user_id', $user_id)->orderBy('created_at', 'DESC')->paginate(10);
		}
		return view('admin.posts.index', ['posts' => $posts]);
    }
public function index ( ) { if ( Sentinel :: inRole ( 'administrator' ) ) { $ posts = Post :: orderBy ( 'created_at' , 'DESC' ) -> paginate ( 10 ) ; } else { $ user_id = Sentinel :: getUser ( ) -> id ; $ posts = Post :: where ( 'user_id' , $ user_id ) -> orderBy ( 'created_at' , 'DESC' ) -> paginate ( 10 ) ; } return view ( 'admin.posts.index' , [ 'posts' => $ posts ] ) ; }
Display a listing of the resource.
Display a listing of the resource .