Answer the question
In order to leave comments, you need to log in
Why is Laravel throwing an error in routing?
I decided to get acquainted with the Laravel framework. Installed it on OpenServer.
Created a test controller HomeController. In the routes.php file, I created 2 paths to the test actions of the HomeController controller. And here there was a strange error with routing.
When I specify the path message/{id}/edit and the path test/{id}/edit in the routes.php file, the framework gives an error of this kind screenshot , but as soon as I comment out any of the paths I created, the error disappears screenshot
Why does Laravel give an error Label 'Route' already defined when I write both routes at the same time?
routes.php file code
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', '[email protected]');
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
Route:get('message/{id}/edit', ['uses'=>'[email protected]', 'as'=>'message.edit']);
Route:get('test/{id}/edit', ['uses'=>'[email protected]', 'as'=>'test.edit']);
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class HomeController extends Controller {
public function index(){
//return "HomeController action Index";
return view('index');
}
public function edit($id){
dd($id);
return view('edit');
}
public function test($id){
dd($id);
return view('edit');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question