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()
    {
        $posts = Post::with('category','user')->orderBy('id','DESC')->get();
        return response()->json([
            'posts' => $posts,
        ], 200);
    }
public function index ( ) { $ posts = Post :: with ( 'category' , 'user' ) -> orderBy ( 'id' , 'DESC' ) -> get ( ) ; return response ( ) -> json ( [ 'posts' => $ posts , ] , 200 ) ; }
Display a listing of the resource.
Display a listing of the resource .