Back

Laravel route issue in 5.3 version


I have issue in Laravel 5.3 when i am trying to user group routing and try to call controller function as route url. Below is my route and controller function.

Route::group(["middleware" => "web"], function(){

Route::controller('/','Frontend\MainController');

});

Here you can see my controller code where i define the function with request type. so i can able access the url using function name. Below is function i have created for routing.

<?php namespace App\Http\Controllers\Frontend; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Http\Requests; use App\User; use Auth; use Crypt; use DB; use Mail; use Redirect; use Validator; use Session; class MainController extends Controller { /******************************* ********** Home Page Route ***** *******************************/ public function getIndex(){ return View('welcome'); } /******************************* ********** Register Get ******* *******************************/ public function getRegister(){ dd('Testing'); return View('auth.register'); } /******************************* ********** Register POST ****** *******************************/ public function postRegister(Request $request){ $validator = Validator::make($request->all(),[ 'first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required|min:6|confirmed', ]); if($validator->fails()){ $errors = self::errors($request->all(),$validator->errors()); return response()->json($errors); } User::register($request); return response()->json(["result" => 'success']); } } Note : I have tried with Route::resources([]) its only find the index function of class.
eaponiente replied 3 months ago

The following features are deprecated in 5.2 and will be removed in the 5.3 release in June 2016:

  • Implicit controller routes using Route::controller have been deprecated.
  • Please use explicit route registration in your routes file. This will likely be extracted into a package.

https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0

Elsner Technologies replied 3 months ago

Route::controller have been deprecated in laravel 5.3,5.4,5.5


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us