bmm bmm - 9 months ago 197
PHP Question

Method controller does not exist.

So I have used this format again. In my routes.php I have

Route::controller('datatables', 'HomeController', [
'PaymentsData' => '',
'getIndex' => 'datatables',

In my HomeController.php I have

public function getIndex()
return view('payments.index');

* Process datatables ajax request.
* @return \Illuminate\Http\JsonResponse
public function Payments()
return Datatables::of(DB::table('customer'))->make(true);

Anytime I try
php artisan
I get
[BadMethodCallException] Method controller does not exist.

Question, is this form of doing it Deprecation or why anyone spot something wrong? Kindly assist. Thank you.


As far as I'm aware that's never been available for Laravel 5. I haven't used 4 so I'm not sure about prior to 5. But in 5 you need to use Route::get and Route::post.

Route::get('datatables', ['as' => 'HomeController', 'uses' => 'HomeController@getIndex']);
Route::get('payments-data', ['as' => 'HomeControllerPaymentsData', 'uses' => 'HomeController@Payments']);

Yep, it was removed as using implicit controllers is bad practice -