My laravel 5.4 not identify the new route i added - laravel

I have uploaded a site to cpanel and after some days i added a new route and now the site cannot identity the new route..and when i check php artisan route:list, i cant find it on the list
below are the new route i just added...both of them says page cannot be found..i have try to clear cache still i get same error
Route::get('foo', function () {
return 'Hello World';
});
Route::get('/buycabletv', 'WalletController#buycabletv')->name('name.buycbl');

php artisan cache:clear
php artisan route:cache
this fixed it for me..

Related

In Laravel, instead of the error template, SW.js is practiced

I used to create errors templates
php artisan vendor: public --tag = Laravel-Terorors
But instead of calling the page 404, for some reason, SW.js with a disorder "Page Not Found!"
Teams
php artisan Cache: Clear
php artisan Config: Clear
php artisan Optimize: Clear
php artisan Route: Cache
did not work
How to fix the conclusion of error pages?

When l renamed layouts/admin.blade.php I got layouts.app ref error

Making adminarea in Laravel 8 / livewire 2.5 / tailwindcss: 2.2 app
I renamed file.
resources/views/layouts/app.blade.php
into
resources/views/layouts/admin.blade.php
and fixed in View/Components/AppLayout.php :
public function render()
{
return view('layouts.admin');
}
and run commands :
php artisan config:cache
php artisan route:cache
php artisan cache:clear
php artisan view:clear
php artisan clear-compiled
composer dump-autoload
but I still got error :
View [layouts.app] not found. (View: /Project/vendor/livewire/livewire/src/Macros/livewire-view-component.blade.php)
Looks like there is some default "app" ref, which raise this error?
Which is valid way t5o split my app into several layouts?
Thanks!

Some URLs are 404 in production

I have a Laravel 7 project that I deploy using Deployer and everything works as expected. A few days later, I created a new route, /privacy-policy. I also created a controller and a Blade template. Everything seemed to be working great. However, upon deployment, surprisingly there was a 404 error. All the other links are working fine.
Route
Route::get('/home', 'HomeController#index')->name('home');
Route::get('/privacy-policy', 'HomeController#privacy');
Controller
public function privacy()
{
return view('app.privacy-policy');
}
Even a closure doesn't work.
Route::get('/', function () {
return view('app.privacy-policy');
});
I ran the following commands, but it didn't help.
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan config:cache
Why don't you run php artisan route:list so that you can verify the URI and name are actually correct? For instance if you see 'app.privacy-policy' in the URI column then verify that it's named that and also in your controller. Basically fix your route.
Route::get('app.privacy-policy', 'HomeController#privacy')
->name('app.privacy-policy');
public function privacy()
{
return view('app.privacy-policy');
}

Mixed Content, This request has been blocked; the content must be served over HTTPS , Laravel

I have this error one production env. only on some routes, I see no difference between the routes that works and the few of them that don't work. All my routes are in web.php, and in front I try to access via Vuejs/Axios.
Also, the both url from error when I try to access them I get to https://, even if I try http:// , I get redirect to https.
What I tried till now.
.env
APP_URL=https://my.url
web.php
URL::forceScheme('https'); //at the top of the file
App/Providers/AppServiceProvider
public function boot()
{
URL::forceScheme('https');
}
Also:
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
php artisan config:cache
npm run prod
I found a strange solution.
I changed the route name from random_question to random, also the controller method name that was show to random and works.

Getting messages feature in Debugbar to work in Laravel

I've installed Debugbar for Laravel as described in the steps on the website https://laravel-news.com/laravel-debugbar; and tried to make use of the Messages feature by placing the following below in my code.
Debugbar::info($object);
Debugbar::error('Error!');
Debugbar::warning('Watch out…');
Debugbar::addMessage('Another message', 'mylabel');
But when I run my website, I get the error message from Laravel saying:
1/1
FatalErrorException in HistoryController.php line 11:
Class 'App\Http\Controllers\Debugbar' not found
I have to go like /Debugbar::info(...) or put use Debugbar at the top of my code to not get the error message. Why can't I use it straight like Debugbar::info(...)?
To be able to reference the facade without prefixing it with \ you should add
use Barryvdh\Debugbar;
to the top of your controller.
after adding setting code in /config/app.php
you can use it as a facade
app('debugbar')->info('info message');
or
debugbar()->info('message');
no need use
I think you should try this :
first you add below code in config/app.php
in provider section
'Barryvdh\Debugbar\ServiceProvider',
in aliases section
'Debugbar' => 'Barryvdh\Debugbar\Facade',
after you should clear the cache like:
php artisan config:cache
php artisan cache:clear
php artisan config:clear
Hope this work for you !
Firstly, Go to the terminal and install by typing:-
composer require barryvdh/laravel-debugbar
In second step, Check your laravel verision:-
php artisan --version
In third if your laravel version is greater than 5(Laravel 5.x)
add the ServiceProvider to the providers array in config/app.php
Barryvdh\Debugbar\ServiceProvider::class,
add this to your facades in app.php:
'Debugbar' => Barryvdh\Debugbar\Facade::class,
Finally, published vendor configuration by command:-
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
After vendor published clear cache,route,view by command
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan dump-autoload -o

Resources