I'm trying to install the package Laravel-permission v5 for a project in Laravel 8.
Following the instructions at the documentation, I runned
composer require spatie/laravel-permission
and to be able to migrate the permission tables I executed:
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
Instantly, in the file database/migrations/create_permission_tables.php it gives me the error
Undefined type 'Spatie\Permission\PermissionRegistrar
What can I do? I'm new in Laravel
Did you import it in config/app.php ??
Try this:
php artisan optimize:clear
# or
php artisan config:clear
php artisan migrate
Related
I'm trying to run a laravel project on wampserver.
I have the following structure:
I executed the following commands :
composer update
composer install
php artisan cache:clear
php artisan config:clear
And when I run this Cmd: php artisan key:generate, I get the following error:
ErrorException
file_get_contents(C:\wamp64\www\casting\.env): failed to open stream: No such file or directory
at C:\wamp64\www\casting\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:96
I don't know what I should do.
in my laravel 8 project i install jetstream by the following command.
composer require laravel/jetstream
then i put the following command
php artisan jetstream:install livewire
then i give the command npm install and npm run dev and run migration.
but when i run my laravel project my login, registration and all other jetstream page broken. it seems css and js are not working. i have followed all the existing stackoverflow process but no improvemnet.
this is registration page image
I have a Laravel 9 project which works fine on local, but after uploading it to the online server I get this error :
Fatal error: Uncaught ReflectionException: Class "config" does not exist in /.../vendor/laravel/framework/src/Illuminate/Container/Container.php:875 Stack trace: #0
This project is not in the root folder but inside another folder, because I have multiple laravel projects. The other one laravel 8.8 is working fine.
That's what I've tried so far:
delete vender folder and install again
delete files in cache folder
run command $ php artisan optimize:clear
run these commands :
composer install
composer dump-autoload
php artisan cache:clear
php artisan config:clear
nothing wrong with my .env file, I just left the default of Laravel
I solved this issue.
I had some missing php extensions on the server. Installing them solved the issue.
Check the Laravel 9 System Requirements here in their doc.
run this code on your server to see your installed extensions and install everything that is missing.
<?php
echo "<pre>";
print_r(get_loaded_extensions());
echo "<pre/>";
Remove all the content of bootstrap/cache first:
cd bootstrap/cache/
rm -rf *.php
Then run:
cd ../../
composer dump-autoload
I have a fresh installation of laravel 8 and I have also installed livewire but when I register I get the error
The "C:\xampp\htdocs\sms\app/Http/Livewire" directory does not exist. (View:
C:\xampp\htdocs\sms\resources\views\layouts\app.blade.php) (View:
C:\xampp\htdocs\sms\resources\views\layouts\app.blade.php)
I followed the instructions in the laravel documentation page.
What could I be doing wrong?
I guess you did run the third command php artisan jetstream:install inertia too, that could have removed livewire, Try rerunning the second command php artisan jetstream:install livewire to install livewire then run npm install followed by npm run dev
Create a new livewire component to generate those directories. Reinstalling did not create them for me.
php artisan make:livewire counter
If you haven't started anything yet, just re-install laravel and run the command php artisan jetstream:install inertia cause there's an error when reverting back from livewire to inertia.
Let's say that we made a complete app module in Laravel:
php artisan make:model Post -a
Is there any way to delete or export this module and install it into another Laravel framework?