Route issue in Laravel 5.7.2 - laravel-5.6

I have just downloaded Laravel 5.7.2 project and found an issue below.
Below line does not work in Laravel 5.7.2 and gives 404
Route::get('/login',
array(
'uses' => 'Annonymous\Web\Auth\Login\LoginController#showLoginForm',
'as' => 'showLoginForm'
)
);
Below works in Laravel 5.7.2
Route::get('/', function () {
return view('Annonymous.welcome');
});
Below code works in Laravel 5.6.16 and 5.6.33
Route::get('/login',
array(
'uses' => 'Annonymous\Web\Auth\Login\LoginController#showLoginForm',
'as' => 'showLoginForm'
)
);
Any idea why the same code does not work in 5.7.2 ?
I can confirm that the route is present in the route list.

Since your project is not in root of Localhost
Try 'php artisan serve'
It Will Work

Related

I have not valid laravel pagination url in routes

in my Laravel 8 / tailwindcss 2 app
I use pagination and failed to create valid page url with routes :
Route::group(['middleware' => ['auth'], 'prefix' => 'admin', 'as' => 'admin.'], function () {
// http://local-tads-back.com/admin/categories/page?=3
Route::get('categories/page?=/{page?}', [CategoryController::class, 'index'])->name('CategoriesFilter');
Route::resource('categories', CategoryController::class); // app/Http/Controllers/Admin/CategoryController.php
...
I got error :
Method App\Http\Controllers\Admin\CategoryController::show does not exist.
I do not have show method and try to set page condition before Route::resource ?
Is my condition invalid ?
Thanks!
you can use this
Route::resource('categories', CategoryController::class)->except(['show'])
ref link https://laravel.com/docs/8.x/controllers#restful-partial-resource-routes

404 Page not found in laravel

I'm trying to add a new page in laravel. I've checked the index page, controller and I keep getting a 404 error.
web.php
Route::group(
['namespace' => 'Admin', 'prefix' => 'admin', 'as' => 'admin.', 'middleware' => ['role:admin']],
function () {
Route::group(
['middleware' => ['licence-expire']],
function () {
Route::resource('curriculum', 'AdminCurriculumController');
Controller
public function index()
{
$this->curriculum =Curriculum::count();
return view('admin.curriculum.index', $this->data);
}
By using prefix all routes in the group get the admin/ prefix. The curriculum resource can then be found at localhost/admin/curriculum/. You can list all available routes by issuing php artisan route:list
If the route doesn't show up in php artisan route:list try clearing the cache: php artisan route:clear. If this doesn't work try adding a test url to ensure the cache is cleared:
Route::get('/', function () {
return view('welcome');
});
Try
php artisan cache:clear
You have probably cached your routes, so you can't add any more because Laravel will now be based on the cached file and not on the web.php file you are updating

Laravel route group issue (blank page)

config: laravel 5.5
web.php
Route::group([
// 'middleware' => ['auth', 'is_admin'],
'namespace' => 'Admin',
'prefix' => 'admin',
],
function () {
Route::get('/', function(){
return 'admin';
});
Route::get('/pages', 'AdminController#pages')->name('admin_pages');
});
php artisan route:list
http://prntscr.com/moltmg
but get http://prntscr.com/moluky empty page
I don’t know what the problem is, I’m registering the path, I’ll use group, but I’m getting a blank page, no error, nothing. Other path work fine, also if I register a path in a group, for example:
admin / dashboard
everything is fine, only this one does not work.
Try running these commands.
php artisan config:clear
php artisan cache:clear
composer dump-autoload -o
if still not working.
provide 777 permission to storage and bootstrap/cache folders.
you need to add the route::get in your group.
this is an example that can help you :
Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function()
{
//All the routes that you have :
Route::get('/pages', 'AdminController#pages')->name('admin_pages');
});
Hope this helps :) good luck
I apologize for the disturb, I am an idiot and created the "admin" folder in the "public" folder.

Laravel 5 routing-resource issue

I am trying to use Laravel 5's resource inside group and it is not working
Route::group([
'prefix' => 'apps',
'namespace' => 'App',
], function () {
Route::resource('/', 'AppController', ['only' => ['show', 'index']]);
//but if I am adding something after / it works
Route::resource('/asd', 'AppController', ['only' => ['show', 'index']]);
Route::get('/{slug}/{userId}', 'AppController#shared');
});
I am doing something wrong, or it is simply not allowed?
Thanks.
I think it's not gonna work. You could try to use:
Route::resource('something', 'AppController', ['only' => ['show', 'index']]);
And then use URLs like /apps/something/slughere to call #show action.
You can look at your current working routes by calling this command:
php artisan route:list
If you'll run it now, you will see something like this:
apps/{} | apps..show
Which is not working route.
Try putting
Route::resource('/', 'AppController', ['only' => ['show', 'index']]);
at the bottom

DaveJamesMiller Breadcrumbs Error - Laravel

I am currently trying to set up breadcrumbs for my Laravel 5 application. Unfortunately, I am currently being presented with this error when I access localhost:8888/auth/login:
ErrorException in
/Users/ben/Sites/laravel/vendor/davejamesmiller/laravel-breadcrumbs/src/CurrentRoute.php
line 29
The current route (GET /auth/login) is not named - please check
routes.php for an "as" parameter
Routes.php:
Route::get('auth/login', 'Auth\AuthController#getLogin',
['as' => 'login', 'uses' => 'Auth/AuthController#getLogin']);
The error is shown with or without the ['as' => 'login', 'uses' => 'Auth/AuthController#getLogin'] addition.
Breadcrumbs.php
Breadcrumbs::register('login', function($breadcrumbs)
{
$breadcrumbs->parent('home');
$breadcrumbs->push('Login', route('login'));
});
Thank you for your help.
I resolved this issue by changing the route to the following:
Route::get('auth/login',
['as' => 'login', 'uses' => 'Auth/AuthController#getLogin']);
You can only declare which controller method you're using once.

Resources