skip to Main Content

How to use paginate in query in laravel?

I use this query: $category = Category::whereStatus(1)->first(); $d = $category->products()->get(['id', 'price', 'status']); $d = $d->where('price', '>', 0)->where('status',1)->sortByDesc('price'); return $d->values()->paginate(16); Category Model: public function products() { return $this->belongsToMany(Product::class); } But show this error: BadMethodCallException Method IlluminateDatabaseEloquentCollection::paginate does not exist. How to…

VIEW QUESTION

Laravel api receive error 404 not found but I don't understand why

I don't know why, but I continue to receive 404 when I call my endpoints on postman my routes: Route::get('getlist', 'AppHttpControllersApiController@getList'); Route::post('login', 'AppHttpControllersAuthController@login'); Route::post('/register','AppHttpControllersAuthController@register'); I don't know if it's relevant but I've done changes in my auth.php also 'guards' =>…

VIEW QUESTION

Laravel localhost page showing the error IlluminateViewFileViewFinder::__construct(): Argument #2 ($paths) must be of type array, null given,

My localhost laravel is showing the below error: TypeError IlluminateViewFileViewFinder::__construct(): Argument #2 ($paths) must be of type array, null given, called in F:laravelvendorlaravelframeworksrcIlluminateViewViewServiceProvider.php on line 84 PHP 8.1.2 Laravel 10.24.0 Here is F:laravelvendorlaravelframeworksrcIlluminateViewViewServiceProvider.php file LINE 84 /** * Register the…

VIEW QUESTION
Back To Top
Search