I am trying to get some json data from pagination laravel but the process returns with a status code 500 and gives a massage "Method [view] does not exist on [App\Http\Controllers\Api\ConsumerController]."
Here is my code api.php
Route::get('/consumer/view/paginate', 'Api\ConsumerController@paginate_consumer');
Here is my code ConsumerController on paginate_consumer method
public function paginate_consumer()
{
$consumer = Consumer::paginate_consumer();
return response()->json($consumer);
}
Here is my code model Consumer on method paginate_consumer()
public static function paginate_consumer()
{
try{
$consumer = Consumer::where('void', 0)->paginate();
return $consumer;
} catch(\Exception $e){
var_dump($e->getMessage() . ' ' . $e->getFile() . ' ' . $e->getLine());
}
}
My expectation is that I can return json data using pagination laravel. Can anyone help me?