BadMethodCallException in line Macroable.php 74: Method controller does not exist

I get a little problem when I follow the route controller.

Web.php Code:

{"
Route::controller('/admin','adminController');
"}

Code adminController.php:

{"
<?php
namespace App\Http\Controllers;
class adminController extends Controller{
public function getDashboard(){
echo " Get Dashborad Method ";
}}
"}

When I clicked the http://localhost:8000/admin/dashboard error:

Display ("BadMethodCallException on line Macroable.php 74: Method controller does not exist.")

Here is the SnapShot:

http://take.ms/3NqA4

Please take a look and tell me what is wrong with the code.

+8
source share
4 answers

ran into the same problem recently. Laravel 5.3 does not support the Route :: controller () method. You need to change it to Route :: get (). See how it is used here https://laravel.com/docs/5.3/routing#basic-routing .

+8

, .

. IDE

use Illuminate\Routing\Route;

, . (web.php api.php) Illuminate\Routing\Route.

EDIT: Laravel 5.5

+7

. , , ,

use Illuminate\Routing\Route

web.php.

0

,

$table->int('TeachingGroup_id');

, int, ,

0

Source: https://habr.com/ru/post/1654921/


All Articles