src/Http/Controllers/PagesController.php
public function index()
    {
        $entries = WinkPage::when(request()->has('search'), function ($q) {
            $q->where('title', 'LIKE', '%'.request('search').'%');
        })
            ->orderBy('created_at', 'DESC')
            ->paginate(30);

        return PagesResource::collection($entries);
    }
public function index()
    {
        $entries = WinkPage::when(request()->has('search'), function ($q) {
            $q->where('title', 'LIKE', '%'.request('search').'%');
        })
            ->orderBy('created_at', 'DESC')
            ->paginate(30);

        return PagesResource::collection($entries);
    }
public function index ( ) { $ entries = WinkPage :: when ( request ( ) -> has ( 'search' ) , function ( $ q ) { $ q -> where ( 'title' , 'LIKE' , '%' . request ( 'search' ) . '%' ) ; } ) -> orderBy ( 'created_at' , 'DESC' ) -> paginate ( 30 ) ; return PagesResource :: collection ( $ entries ) ; }
Return pages.

@return \Illuminate\Http\Resources\Json\AnonymousResourceCollection|\Illuminate\Http\JsonResponse
Return pages .