Laravel cache store does not support tagging - laravel

I am getting this error since I installed Zizaco\Entrust on my Authentication Routes.
BadMethodCallException: This cache store does not support tagging.
I had few known issues and I had to change some config options and that is the reason I am getting this error.
What does this error relate to so that I can find the problem and fix it instead of finding the code I modified?
Thanks

Laravel file and database drivers don't support tags.
What you need to update, to fix this issue is simply changing the cache driver from file to array in your .env (located in root folder) file as below.
CACHE_DRIVER=array
Hope it helps!!

Cache tags are not supported when using the file or database cache drivers. The Entrust package probably uses them somewhere. You should be ok if you change it to array, memcache or apc for example.
https://laravel.com/docs/5.2/cache#cache-tags

open .env file and
change
CACHE_DRIVER=file to CACHE_DRIVER=array
Or add this line showing below
CACHE_DRIVER=array
After that go your command prompt or open the terminal then type
php artisan config:cache

Use this command in your command prompt
php artisan config:cache

In Your .env file change
CACHE_DRIVER=file
To
CACHE_DRIVER=array
Then run these commands
php artisan config:clear
php artisan config:cache
It will work

in your .env file change to cache array
CACHE_DRIVER=array
and dont forget to run
php artisan config:cache

Just change .env
CACHE_DRIVER=file
To
CACHE_DRIVER=array

Yes, Laravel file and database drivers doesn't support tags. What you can do to while developing is change the driver to array in your .env file.
CACHE_DRIVER=array

Cache tags are not supported when using the file or database cache drivers. The Entrust package probably uses them somewhere.
Open .env file set
CACHE_DRIVER = array
SESSION_DRIVER = file
then make command in terminal
php artisan config:cache

If you continue having the issue, you should change your entrust version to
dev-laravel-5

My solution was to change in cache.php the following line from "file" to "array" as well:
'default' => env('CACHE_DRIVER', 'array')
Hope it helps!

Related

Laravel env('APP_URL') is not returning the correct value for localhost

When trying to retrieve the APP_URL from the Laravel config it returns the wrong URL for development only.
My env file has the following:
APP_URL=http://127.0.0.1:9000
However when I call env('APP_URL') it returns me:
'http://localhost'
Which will not work with my current docker set-up it has to be 127.0.0.1:9000
In my config/app.php file I have the following:
'url' => env('APP_URL')
I have tried php artisan config:cache and php artisan config:clear but I still get the same result of http://localhost
Any ideas on where it could be getting http://localhost from other than the .env or config/app.php?
Thought it would be worth noting using config('app.url') also returns http://localhost
I found out there is an undocumented feature when loading .env files. If you have a .env.dev file in your project folder it will load this config over everything else if your application is in dev mode. It's documented that .env.testing is used in testing which makes sense but it also does it for dev with .env.dev
The application I was working on had a .env.dev and it was this file that had the http://localhost string inside of it.
Just in case anyone is having this issue in production, these are the steps that worked for me:
Make sure that the .env file is specifying that the app is in production. APP_ENV=production
Run php artisan optimize:clear
"localhost" is probably the default value. You error indicates that the .env file is not read at all. Make sure you're not editing .example.env, check if other env variables are accessible, check for typos, check file permissions on .env and if it's located in the root folder of the project.

php artisan serve does not allow change .env file

I found the problem
if i restart php artisan serve the changed values are applied. this is
the norm? how can i solve this
I created a router where I output config information
I'm trying to change value from .env file, for example APP_NAME, from APP_NAME="Nuxt + Laravel" to APP_NAME="test" but the change is not displayed on the page!(of course I reloaded the page šŸ˜Š)
I was trying to look through php artisan tinker
It works!
But my config remains the same. I can not solve this problem for a week now.
I cleared the cache!!! I tried php artisan cache:clear, php artisan config:clear (i tried all command for cache)
CACHE_DRIVER=file
I deleted files bootsprap/cache/*, storage/framework/cache/*.
I tried everything!!!
I have this project on the github: https://github.com/iliyaZelenko/laravel-nuxt.
Please help me, I want my project to be used by other people.

Why my email sender does not update when I change the settings in env laravel on staging server?

I use laravel 5.3 and I change env on the staging server on the forge (https://forge.laravel.com)
I change like this :
#MAIL_HOST=smtp.gmail.com
#MAIL_PORT=587
#MAIL_USERNAME=mygmail#gmail.com
#MAIL_PASSWORD=secret
#MAIL_ENCRYPTION=tls
MAIL_HOST=mail.myshop.id
MAIL_PORT=587
MAIL_USERNAME=contact#myshop.id
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=tls
If I try send mail in my system, the email sender is mygmail#gmail.com
Should the email sender contact#myshop.id
How can I solve this problem?
I use laravel 5.7 running with supervisor to handle the queues. Following steps helped me out:
php artisan config:cache
This command refreshes the config file in the cache. you can check it in bootstrap/cache/config.php and look for the 'mail' array.
php artisan queue:restart
Tell the queue to use the new configs and restart the supervisor.
If the above commands didn't solve the problem, these commands might help:
php artisan cache:clear
sudo supervisorctl restart all
sudo nginx -s reload
Also, you can set your from address. Just take a look at config/mail.php file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=xxxxxxxxx
MAIL_PASSWORD=xxxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply#youremail.com
MAIL_FROM_NAME=yourname
On Laravel 5.1 php artisan config:clear did not work. Instead, I needed to run
php artisan config:cache
Iā€™m hesitating between two possible issues..
First possibility: That might be because of the use of a cache by your artisan server if you are running your app with it.
So try to stop your artisan server and restart it
Second one: the email is set somewhere else. So check your config files (in config/ directory).
Hope this will help
I know this is an old question, but I was in the same situation and found something that worked for me
php artisan config:clear
Maybe can help someone else landing here.
php artisan config:clear;
to call this from a route (for shared hosting without SSH for example)
Artisan::call('config:cache');
MAIL CONFIGURATION on your ENV doesn't mean that will be your sender email to be display on the recipient that will just be the credentials to be used in order the email service work, if you want you may configure it using the mail.php configuration file in config folder or directly to the Mail function of laravel.
$mail->from(YOUR_EMAIL_ADDRESS,YOUR_DISPLAY_NAME);

Deleted config.php and now site is returning HTTP error 500

We lost our config.php file and the site instantly broke. We tried putting an empty config.php file but no luck. Restarted the server but also no luck. What's strange is that we didn't have a config.php file earlier that day. Our live app is running without a config.php as well.
To clarify, this file resides in /bootstrap/cache/config.php
Thanks!
You can try to run php artisan config:clear from the command line to clear the config cache or php artisan config:cache to create a new config.php. Note that you need to use config() instead of env() in your code if you want to use config cache

Trait 'Illuminate\Foundation\Auth\Access\AuthorizesResources' not found

Anyone familiar with this error i'm getting?
Please help thanks.
If you are using Laravel 5.3 do the following:
From the upgrade guides: The AuthorizesResources Trait
The AuthorizesResources trait has been merged with the AuthorizesRequests trait. You should remove the AuthorizesResources trait from your app/Http/Controllers/Controller.php file.
Seems like the problem is with your version of laravel/framework.. Running composer update should pull in the latest version (which is 5.2.39). If that doesn't work for you, then I'm not sure what else you can do. Perhaps try composer self-update before you do it.
If you run composer info laravel/framework the 4th line should show you the latest version from packagist, which is: 5.2.39.
Edit: You could try and clear your package cache: composer clearcache
Does Laravel connect to database? I had this error and it was caused by a wrong database configuration in .env file.
Try these settings in .env file:
1. Open .env file in your project's folder. Don't touch the .env.example file found in the same location as it's an example of .env default configuration. If something goes wrong with your .env file, you can copy and paste the configuration from the .env.example file to .env.
2. Change the following 4 lines to your own configuration:
DB_HOST=localhost
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=
DB_DATABASE It's the name of your database. Should be 'forge' by default or check your phpMyAdmin to determine which database you need to use. You can create a new database if you're an administrator of phpMyAdmin ('root' user).
DB_USERNAME This is your username when you log in to phpMyAdmin. Should be 'forge' by default.
DB_PASSWORD Your phpMyAdmin should not be protected with password by default. The password is set later manually. In case you'll set the password, add it to DB_PASSWORD line after you do so.
3. Save the modified .env file and restart the Apache server.
Try to access your webpage again. This worked for me. I hope it's gonna work for you, too.
P.S. If it doesn't work, check if the .env configuration is right for you. Or use php artisan config:clear to clear cache.

Resources