Trait 'Illuminate\Foundation\Auth\Access\AuthorizesResources' not found - laravel-5

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.

Related

DigitOcean - laravel 8 deployment through Github (error 500)

I deployed the laravel app to digitalocean:
but I don't understand why is it showing error 500??
I connected a github repo to deploy it to digitalocean.
1- I set the build commands to: composer install
2- environment variables are set: APP_NAME, APP_URL, APP_KEY, DATABASE_URL, APP_DEBUG
This is how the repo looks (private)
What seems to be the issue??
I just did check the repo and it seems the vendors folder not there and your build steps look like a typo issue so please run below command
composer install
Still you face the issue then refer the laravel logs for that what went wrong
you also dont have a .env file
maybe copy the .env.example to .env
perhaps follow the instructions on the laravel site for the version you are using.
in your question, you have spelt 'install' incorrectly
turns out there were typos of lower and upper cases in controllers according to the laravel log.
I fixed them and now the site is running. It's weird that these typos didn't trigger erorrs locally..
All You have to do is configure the .env file if u have a .example.env edit the file to .env if u dont have it just try to create one or clone one from another project and do composer install but don't forget to generate a key with php artisan key:generate in the end

Laravel - Why laravel ask to rename .env.example to .env while .env already exist?

In Laravel 6 Documentation second paragraph of Application Key written like this
Typically, this string should be 32 characters long. The key can be
set in the .env environment file. If you have not renamed the
.env.example file to .env, you should do that now. If the application
key is not set, your user sessions and other encrypted data will not
be secure!
Why did they ask to rename it? I also found this paragraph in the Laravel older version. Is there any difference between those since they have the same content but different name?
If you've install Laravel using composer command.
composer create-project laravel/laravel projectname
you don't need renamed the .env.example file to .env. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command.
If you clone project using git clone some folder is ignored by git so you might not get env file as well as vendor folder. Therefore, they will have to manually enter php artisan key:generate for their app to function correctly.
More info SO answer
Laravel need to use .env file to define a database connection, some general setting like application key as well. So if you have no .env file, your Laravel has not a setting for now.
Like they said, If the application key is not set, your user sessions and other encrypted data will not be secure! You need to create / copy /remove the .env.example to the new .env for this reason. for letting our Laravel knows about general config.
By the way, do not use the .env.example like copy-and-paste because it's an example. you need to change the value config to your own.
The simplest way is move it on your server with Filezilla or another FTP program. Rename file, and re-download it on your computer. It works for me last time :)
The .env.example the file is just an example of the .env file. It is not used by the app. It is used to serve as a base for you to edit and rename.
In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually.

Whoops, looks like something went wrong. on server

I uploaded all laravel project on server, its working fine on local but getting error on server, even database configuration and key is configured in env. file. even i renamed .env.example file as .env too but got same error.
Error is
"Whoops, looks like something went wrong."
my error log is here:
[2017-11-06 15:19:07] local.ERROR: exception 'RuntimeException' with
message 'The only supported ciphers are AES-128-CBC and AES-256-CBC
with the correct key lengths.' in
/home/rndspot5/public_html/dev/lea/vendor/laravel/framework/‌​src/Illuminate/Encry‌​ption/Encrypter.php:‌​43
Judging from your error, you need to run php artisan key:generate this will update your key of which in turn will rectify your error.
You will need to either SSH into your public_html folder if you have host permission to do so. Alternatively, you can ask your host provider to either:
Grant you SSH access
Perform this action for you.
You can then run: php artisan config:clear once the new key has been generated.
If you are on shared hosting you can use these steps
Open your .env file, copy APP_KEY to somewhere else as a backup
Run php artisan key:generate from console
Copy the new APP_KEY and upload it to the .env file on your (shared) server
Move the old key back to development
I resolved this issue, by adding web app url in .env and Config/App.php and now its working :) thanks all of you for sharing such a value able knowledge that will help me, may be later.

Laravel 5: Decryption error The Mac is invalid

When i try to login the following error produced:
DecryptException in BaseEncrypter.php line 49:
The MAC is invalid.
I am using xampp with php 7.
The laravel version that i use is 5.2.
*I have change the api key running php artisan key:generate.
**I have trying the following commands: php artisan cache:clear composer dump-autoload composer update with no lucky.
I have clear the history of the browser.
** Here are the values of some variables:
iv=a69g/gRfyCNWTaKeuZ2Kkw==
value=C7DfTHbFWfZq0km633uXMX0ZRd1fuzcFFBgP0vtZj/d4C4Z3btgeFlmU2a1C9TdUlUDof4mnoGhdvEeB/gL1TQ==
mac=c0460e4ea3d724631cf4a12b7b19a5e512ecec8f492b4754e183714cc9d0a05c
Any help would be usefull.
Thanks in advance.
I know this is a little late but it might be useful for future me or someone else.
I had an issue where I had to encrypt something in the database, changed the APP_KEY and then tried to decrypt it and this error happened.
It was an error on redis server.
Hope that someone will help.
There might be some issue with the .env file as I am having the same problem.
There should be space between APP_KEY and APP_DEBUG
I could find a solution I tried everything including regenerating. However, this worked for me... If you have an existing app_key (in another folder/locally) you may want to restore, you can update it in the .env file manually. Locate the APP_KEY entry in the file and replace the value with the key in your initial .env in your previous project

Laravel cache store does not support tagging

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!

Resources