In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "laravel8.5 how to add user rights management," interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "laravel8.5 how to add user rights management"!
1. Use composer to install laravel-permission package
Composer executes the following command
composer require spatie/laravel-permission
2. Generate migration file
Composer executes the following command
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"
3. Generate configuration files
Composer executes the following command
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"
4. Migrating data
Composer executes the following command
php artisan migrate
After execution, I don't know what other people are like. My appearance is reported incorrectly. The prompt is as follows
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
Then Baidu a big circle, according to the change or not, look at the migration file I suddenly realized, database\migrations\2022_01_06_041301_create_permission_tables.php(command generated migration file) this inside several fields of the string type length, manually set it, mine is mysql8.0, I saw this realization at that time;
$table->string('name'); // For MySQL 8.0 use string('name', 125);
Then change the string type of the migration file to such a full, no error will be reported, and then 5 tables will be generated in the database. The migrations table seems useless and can be deleted.
$table->string('name','125'); // For MySQL 8.0 use string ('name ', 125); At this point, I believe that everyone has a deeper understanding of "laravel8.5 how to add user rights management", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.