Maximum function nesting level Using laravel - php

so I started to use Laravel auth and in my Route in web middleware I wrote :
Route::group(['middleware' => ['web']], function () {
Route::auth();
});
and I got this error :
Maximum function nesting level of '100' reached, aborting!
and I tried to use this instead :
Route::auth();
Route::group(['middleware' => ['web']], function () {...});
and then when I wanted to use old function in my form I got this error
Session store not set on request.
can you help me , a tutorial link is also a good idea :)

This is the problem of recursion. So,go into your php.ini configuration file and change the following line:
xdebug.max_nesting_level=100
to something like:
xdebug.max_nesting_level=200
Edit:
If you are using wamp then please comment
zend_extension = "d:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9.dll //here wamp is installed in d drive.
in my php.ini file. This extension should be limiting the stack to 100 .

I fixed this problem by adding this line in bootstrap/autoload.php
ini_set('xdebug.max_nesting_level', 200);

Related

404 error when adding a different route - Laravel dead simple routing

I've been laraveling for 5 months now but I reformatted ubuntu and installed Laravel, this time, it's Laravel 7 instead of Laravel 6. My problem is simple routing giving an error. It's so dead simple you might think I'm a stupid beginner.
In my Web.php
Route::get('/about', function () {
return view('welcome');
});
Route::get('/', function () {
return view('welcome');
});
I also tried using a controller that returns a view and just a simple "string" in Web.php
Route::get('/about', 'UserController#index');
Typing http://localhost/about in the address bar in chrome causes 404 error.
As you can see, there should be no problem returning the same view('welcome'), even if I return a simple return "TEST";, results are the same.
I tried downgrading to Laravel 6 by deleting vendor, changing the Laravel v6 in composer.json and running composer install but still the same, so I think it's not the version.
This has never happened to me before even when I first started with Laravel 6 five months ago and it's a totally fresh project.
enable rewrite_mode of Apache server and restart Apache server it will solve the issue.
Run server with php artisan serve
and then try http://localhost:8000/about hope it will fix your problem
OR
Simply use http://localhost/project/about

ERR_TOO_MANY_REDIRECTS Laravel on server

Anyone help me to prevent this error on the server, localhost works fine.
I did not find the error even if I searched.
this is the error every time used the application, cookies problem
my code on routes
Route::auth();
Route::group(['middleware' => ['auth']], function () {
Route::get('/', 'DashboardController#index');
Route::get('/users','UsersController#index');
Route::get('/users/create','UsersController#create');
Route::post('/users/store','UsersController#store');
Route::get('/users/list_data','UsersController#list_data');});
Is the problem with the server? or my code?
Sorry for my bad English

Laravel Mcamara\LaravelLocalization giving error when used in package

I just installed Mcamara\LaravelLocalization following the documentation but I get an error Call to undefined method Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale()
The error comes from the web.php routes file of my package. If I use the same code in my main routes file it works perfect. All other routes of my package work, only those I want to localize don't.
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['web', 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath']], function() {
Route::get('/{page}', 'FrontPagesController#index');
});
I found on stackoverflow that this could be because locale in config/app.php is not set but in my case it is set to en.
Can someone help me?
I faced this problem and I just run php artisan config:cache in the terminal and I restarted my editor VS Code

Laravel 5.2, Maximum function nesting level

Please, help me to find what is going on.
I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29)
This is route.php
Route::get('/', 'TestController#index');
This is the test controller
class TestController extends Controller
{
public function index()
{
return view('home');
}
}
The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5".
When I add the 'web' middleware, as following
Route::group(['middleware' => ['web']], function () {
Route::get('/', 'TestController#index');
});
I get this error: "Maximum function nesting level of '100' reached, aborting!".
I read some thread about xDebug, so i add this line to xdebug.ini
xdebug.max_nesting_level = 1000
but nothing changed.
Any help? Or any suggestion on what else could I check?
Thank you
Try to remove web middleware, because now it applies automatically to all routes. So, since v5.2.27 you do not need to apply web middleware to avoid errors.
If you installed new application (5.2.27 at the moment of installation), you don't have to use web middleware group because it will be automatically applied, however if you installed version prior to 5.2.27 and then updated to 5.2.27 or later you still need to use it.
So first you need to verify app/Providers/RouteServiceProvider.php if there's web middleware group automatically applied. If yes, you should remove it from routes.php because you might get unexpected behaviour.
If it's not the case, you should verify what Middleware are included into web middleware group because some of them might cause problems

Routing is not working laravel 5?

I have just installed fresh laravel 5.1, only root page is showing that
Route::get('/', function () {
return view('welcome');
});
It's working perfectly but rather than any other route not working
like:
Route::get('user', function () {
return "hello";
});
It throws exception 404 not found. Please help me to get out from this. Thanks in advance.
It may be because of rewrite mode is not enabled in your system. Either you enable it or access through the following url with index.php
http://localhost/blog/public/index.php/user

Categories