0

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?

Mozahler
  • 4,958
  • 6
  • 36
  • 56
  • 1
    That's not where this error is coming from. Do you have a route pointing to `ConsumerController@view`? – aynber May 23 '18 at 17:02
  • Oh i see. THANKKK YOUUUU I CAN HANDLE THAT, my problem is one of my code lines in api.php is wrong -____- @aynber. Thank you very much. – Fuad Ardiono May 23 '18 at 17:15

0 Answers0