impossible to show laravel debugbar with laravel 6 - php

I have installed laravel/debugbar in my laravel 6 project, however, I don't see it displayed on my page. I have tried several things :
set APP_DEBUG=true in my .env file
run php artisan config:clear, php artisan route:clear, php artisan cache:clear, php artisan config:clear & php artisan vendor:publish
run composer dump-autoload
set enabled => true in config/debugbar.php
add the following in config/app.php
'Barryvdh\Debugbar\ServiceProvider',
'Debugbar' => 'Barryvdh\Debugbar\Facade',
Nothing helps, I still don't see the debugbar
Does somebody have an idea ? It would help an lot :)

Related

Laravel Repository file changes not working

I have changed one of my repository files. But the changes doesn't working and still getting errors with referring to old file. I tried clearing the cache, but still not working. Below cache clearings tried.
php artisan config:clear
php artisan config:cache
php artisan cache:clear
php artisan view:clear
php artisan optimize:clear
Clearing the linux cache
htcacheclean
rm -rf /var/www/cache/*
Composer autoload also tried
composer dump-autoload
Is anyone got this issue previously and found solution.

Laravel-Permission - permission not found in artisan list - There are no commands defined in the "permission" namespace

Hello Good Developers,
I am using spatie:laravel-permissions package in my application. I have identical code in local machine and production server.
I am having a strange issue with my production environment.
I cannot find permission in list of commands in php artisan list.
When I execute php artisan permission:cache-reset it says
There are no commands defined in the "permission" namespace.
I tried following things to fix this issue
Spatie\Permission\PermissionServiceProvider::class, in app.php
providers
composer update
composer dump-autoload
Cleared all config and application cache.
deleted vendors directory and executed composer install to reinstall all the packages.
Still its not working.
However when I execute dump-autoload it says Discovered Package: spatie/laravel-permission
I am using Laravel 5.7.28 and spatie/laravel-permission:^2.5
My Local system is working fine and I can see permission command in the list there.
Please help! I don't know where should I check now.
Try to run this command:
php artisan optimize:clear
If, for some reason, the command doesn't work, run these one by one:
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan clear-compiled
After one of the above steps, if you are in production environment, run: php artisan config:cache

Jwt Authentication error Argument 3 passed to Lcobucci\JWT\Signer\Hmac::doVerify()

I'm working on a project to learn laravel, I saw a couple of tutorials to use jwt auth in this. It was working good but now is show an error not always but I don't know why. this is it:
Argument 3 passed to Lcobucci\JWT\Signer\Hmac::doVerify() must be an instance of Lcobucci\JWT\Signer\Key, null given, called in C:\xampp\htdocs\inmobiliaria\vendor\lcobucci\jwt\src\Signer\BaseSigner.php on line 42
Sometimes it works but not another. so I don't know what can I do. I tried with
php artisan cache:clear
php artisan config:clear
php artisan jwt:secret
but the problem still there, sometimes i get good answer from server(200) but the most part of then al bad (500).
Screenshots
Here's complete snippet
php artisan key:generate
php artisan jwt:secret
php artisan cache:clear
php artisan config:clear
Before run above commands make sure there is install jwt package, than check its config file name jwt.php in config folder.
In fact it's the right thing to solve it:
php artisan key:generate
php artisan jwt:secret
This error can occur when
JWT_SECRET is missing on the .env
JWT_SECRET is commented in the .env
The value of JWT_SECRET is wrong.
In my case, running php artisan jwt:secret it was appending the key on the current JWT_SECRET. So checking my .env file, the value of JWT_SECRET was very long and wrong (it should be 64 chars long).
To solve it:
Open the .env and remove the JWT_SECRET value (note that you have to remove it and not comment it).
Run php artisan jwt:secret
Run php artisan cache:clear && php artisan config:clear
php artisan jwt:secret
php artisan config:cache
These both command will be enough
I came across this error when I deployed my application after testing and everything else worked well on the local server.
I noticed the following;
It's possible that you are getting this error when you uploaded the applications before implementing the JWT and re-uploaded directly via the Cpanel upload without reuploading the .env file.
if this is the case, the simplest way to solve this is my merely adding the JWT:key in your .env file (at the bottom) ef
JWT_SECRET=roCZauuldMpw5i4039393939393372y98bEWumqd9ls7Uk8DEpr0gIZ6WIWB
Hope this helps :)
This can also happen when using the Laravel Vapor service if you haven't remembered to add the JWT_SECRET to the env file used by Vapor.
In that case just pull the .env file down for the current environment (in this case staging):
vapor env:pull staging
and add the JWT_SECRECT line to it, followed by a push:
vapor env:push staging
and re-deploy.
I had this problem with my Laravel 8.x and PHP 7.4 so I solved the problem by updating my keys just with these commands:
php artisan key:generate
php artisan jwt:secret
I have resolved the same on Hostinger - Shared Hosting in a bit different manner than others explained. On shared hosting's user will not have access to shell/cmd/ssh access to the server - So I have executed the commands using composer - Thanks to Ángel Carlos del Pozo Muela for sharing the idea in https://stackoverflow.com/a/48682668 for a different solution but it worked in my case here as well
I have updated the composer.json >> script tag with extra values
"scripts": {
"pre-generate-key": [
"#php artisan key:generate",
"#php artisan cache:clear",
"#php artisan config:clear"
],"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
]
Followed by that I have created a new parameter in .env file using going to hostinger file manager and deployed the changes.
JWT_SECRET={{value}}
on successful completion of deployment - Tested the all service -> all services started working fine - then I removed the "pre-generate-key" bit from composer.json and re-deployed code
i'm working on App platform - Digital Ocean php artisan jwt:secret does it for me -> it just genarates a new secret and that's what's messing (just check your .env file)
Problem Statement :
TypeError: Argument 3 passed to Lcobucci\JWT\Signer\Hmac::doVerify() m
Facing above problem
Larave version: 8.77
Php Versionn: 7.4
Solution works 100%
php artisan key:generate
php artisan jwt:secret
php artisan cache:clear
Here is the solution it will work for me
php artisan key:generate
php artisan jwt:secret
php artisan cache:clear
php artisan config:clear
Before running the above commands make sure there is an install jwt package, then check its config file name jwt.php in the config folder

Laravel - reading config variable

I don't get it - when I search for this problem I get told to do the followng:
composer dump-autoload
php artisan config:clear
php artisan cache:clear
php artisan view:clear
And yet it is not making a difference. In my .env file:
PASS_DOMAIN=domain.local
In my /config/app.php file:
'pass_domain' => env('PASS_DOMAIN', 'example.com'),
Yet in my middleware located in /app/Http/Middleware/ if I place the following:
dd(config('pass_domain'));
I get nothing. Why cant I access this variable? Originally I had env('pass_domain') but nothing is letting me see this damn variable.
Any help?
Try this
dd(config('app.pass_domain'));

Fatal error: Class 'LaravelLocalization' not found after composer install in production

It's been 3 days since I'm working on translating my site, so I installed LaravelLocalization:
I did everything working in local, then I pushed it in production and executed:
composer install --no-interaction --no-dev
php artisan clear-compiled
php artisan optimize
composer dump-autoload -o
php artisan route:cache
php artisan config:cache
Now, all the "php artisan commands fail with:"
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Class 'LaravelLocalization' not found
In this case, in the composer install script, it fails in:
php artisan clear-compiled
I tried to run:
php artisan cache:clear
php artisan route:clear
But without any results...
Any ideas??? This is not the first time I get this kind of stuff, but I may say that this it's a pain in the ass :(
EDIT:
In my routes.php,
I deleted this line:
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect']],
around all my routes, and now composer install works.
But it doesn't solve my issue, because as soon as I put it back, I still get the same error :(
I resolved it removing the line:
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect']],
in my file routes.php
run again
composer install
and finally
php artisan config:clear
php artisan route:clear
What I don't know is why it happened, and if there is a way to prevent it...
as what the error says, it means that the composer can't locate your package. so be sure to
check your config/app.php file
be sure to put the package in providers and aliases arrays, respectively.
This has been a known issue for a while, but has actually finally been resolved recently. You can read about the issue here.
Basically, running php artisan loads the entire framework, including the cached files. Since the cached files don't have your service provider, you get the error. This includes running php artisan clear-compiled. So, it is using the cached files in the command that is used to delete the cached files.
This issue has finally been resolved as of laravel/framework:v5.2.25 and laravel/laravel:v5.2.27, and backported to laravel/framework:v5.1.33 and laravel/laravel:v5.1.33.
This fix includes a change to the Laravel application (laravel/laravel), in addition to the Laravel Framework (laravel/framework). To implement, you will need to:
1) Update the scripts section of your composer.json file to match that in the laravel/laravel package. Specifically:
remove the pre-update-cmd section
in the post-install-cmd section, replace "php artisan clear-compiled" with "Illuminate\\Foundation\\ComposerScripts::postInstall"
in the post-update-cmd section, replace "php artisan clear-compiled" with "Illuminate\\Foundation\\ComposerScripts::postUpdate"
2) Once you have updated your composer.json, run a composer update. If you only want to update the framework, you can run composer update laravel/framework.

Categories