Things changed, most of these settings will be added to the Laratrust 5 installation by default. For eg. You don't need to create models or edit User model. You may jump directly to the seeder. Anyway, this tutorial is amazing and Alex did great help for both Laravel & Laratrust learners. Those who are working on Laratrust v5 just follow the configurations provided with the doc. Thanks )
@hidajettuzlak63937 жыл бұрын
Just a heads up for those who get error class not found for roles and permissions: Role model should "use Laratrust\Models\LaratrustRole;" instead of "use Laratrust\LaratrustRole;" Same works for Permission model
@volikoto7 жыл бұрын
Thanks but how did you know?
@voneatpen60607 жыл бұрын
check this link you will know. laratrust.readthedocs.io/en/5.0/configuration/models/role.html
@qwerty-gf5fz7 жыл бұрын
this took me an ages to figure out. thanks for the info!
@raymondmichael49877 жыл бұрын
Thanks man; I lost 20min trying to figure it out
@Mightyowlzx7 жыл бұрын
Thanks.
@NickyKeyse7 жыл бұрын
Another top video, very interesting. Thanks for the Laratrust tutorial. All that's missing is you - good luck with the hub.
@oyewodayo7 жыл бұрын
Please is not possible to seed other tables and exempt User table in the seeding. Cos this is run on an existing project which clears off my User datas in the existing table and fails in the terminal
@juanrincon65767 жыл бұрын
Yes sir, another episode!
@ricabomfim5 жыл бұрын
Hi, I'm trying to follow your video and by calling the "php artisan db: seed" command at 29:15 min I get an error. Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined method Illuminate\Events\Dispatcher::fire() Can you help me? My version of Laravel is 5.8.
@ricabomfim5 жыл бұрын
The problem was solved. You must have version 5.2.0 of Laratrust that replaces the $ dispatcher :: fire method (deprecated in 5.4) with $ dispatcher-> dispatch
@zymawy7 жыл бұрын
When I'm Using Authorization I Don't Multi Auth Right For Example I Don't To Make Admin Model ?
@samdeacon79106 жыл бұрын
This series is frickin awesome!
@vardgeskeshishyan3807 жыл бұрын
How can help me, I catch an error [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Laratrust\LaratrustRole' not found;
@vardgeskeshishyan3807 жыл бұрын
Ohhhhhh i understand already, instead of Laratrust\LaratrustPermission must be Laratrust\Models\LaratrustPermission
@ibedelandtsheer74936 жыл бұрын
thank you sir!
@TheChaoticTranquil7 жыл бұрын
I'm doing pretty much exactly the same process but I get [Symfony\Component\Debug\Exception\FatalErrorException] Cannot access empty property when run the "php artisan DB:Seed". It starts generating the Permissions for users, acl and profile but when it comes to creating "superadministrator' user, the above error is issued. btw I'm using Laravel 5.4. I tried to google it but no luck!
@agil-j4n7 жыл бұрын
I don't rly feel like I need Laratrust do I? I can handle it withing the controller functions. and is it any less safer than this? if it is I would like to learn. But my rough guess is that this helps to keep things simple
@jasonwitt957 жыл бұрын
So what made you decide to use Laratrust right after you just did your Multiple Authentication series?
@christostsangaris47856 жыл бұрын
So Jason, what is your conclusion after 1 year? Native multi-auth or Laratrust?
@oldfishergaming7 жыл бұрын
Hi Is there anyone have a same error when running php artisan migrate [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`)) [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes i have googled it but nothing helped so far.
@oldfishergaming7 жыл бұрын
Problem sorted finally Remove mb4 from charset and collation from config/database.php, then it will execute successfully. 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci',
@JacurtisTutorials7 жыл бұрын
This is common if your database is not set to utf8 as the character set. There are two solutions. Either tell Laravel to specify UTF8 as the charset in the database.php file or you can override the max length and keep your native charset (this will be necessary for arabic languages or mandarin characters).
@أبوعائشةالشامي-ف7ر7 жыл бұрын
CryptoMonkey utf8 general_ci for all language Thank you thats help me
@CodeCampus-kv6ui5 жыл бұрын
sir which theme are you using for vscode
@teyimpila75107 жыл бұрын
Hello, I am following this tutorial and at the same time using the knowledge to build my own system. However, the roles and permissions are a little different in my case. It is kinda like slack where a user can belong to multiple channels and have different roles and permissions in each of the channels. Concretely, I want a user to belong to multiple companies and have different roles and permissions in each of those companies. if a user switches from one company to the next, what they see is different based on their roles and permissions in that company. Please, how can I model this using laratrust? MY thought: Add a company_id column to `user_roles` and `permission_users` tables.
@aremoisaac43387 жыл бұрын
[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'App\User' not found when i run php artisan db:seed am running laravel 5.5
@christostsangaris47856 жыл бұрын
@DevMarketer Alex, just finished watching your "Native Multi-Auth" series which were awesome! Is Laratrust an alternative way to reach the same goal just on steroids? Is something that is recommended over your native multi-auth? I know (and you said it) that native its always in your hands to maintain, but what do you suggest we use? Thanks again for taking the time to teach us all these things!
@allaghi7 жыл бұрын
You can use ( php artisan laratrust:setup ) command to let laratrust to setup by itself.
@bartukocakara77944 жыл бұрын
I am getting Target LaratrustSeeder does not exist error mine infos are just like yours. But why this keep failing ?
@bartukocakara77944 жыл бұрын
adding namespace Database\Seeders; in LaratrustSeeder.php solved id
@aditiawidyanto37497 жыл бұрын
i have error message when i run php artisan db:seed [Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION)
@JacurtisTutorials7 жыл бұрын
Check your syntax. It says unexpected end of file, so you probably missed a semi colon or curly brace somewhere.
@prakashale16277 жыл бұрын
Dude! I had a same problem but when I checked there was a one more closing big bracket before 'permissions_map'
@Epsonworkforcewf77107 жыл бұрын
I had run the users migration before, now when I try to run the migration after creating the laratrust migration it is unsuccessful. The error says users table already exists?..How can I successfully run the laratrust migration?
@Kobistas7 жыл бұрын
Delete tables and run migration again.
@visitasia74047 жыл бұрын
did you use with your production ? it's not recommend!
@firstlast-gv2br7 жыл бұрын
i put already the solution , just delete all the tables in your database and change config/database.php ... you have to change the charset and collation to utf8 and utf8_unicode_ci.
@juanalbertovallecardenas32127 жыл бұрын
Great Alex!!! Thanks you for the class :)
@zhacaitou7 жыл бұрын
I am a little confused on the plural and singular usage in laratrust_seeder.php. I think to use singular noun is best practice for Laravel models. According to the laratrust docs , For the role structure. "The first level is the roles. The second level is the modules. The second level assignments are the permissions. " If that is the case, should I use " user=>'c,r,u,d' " instead of " users=>'c,r,u,d' ? And if I want to add my own model to the role_structure. should I use singular or plural?say, " task" or "tasks" .... Or maybe it doesn't matter? thanks!
@JacurtisTutorials7 жыл бұрын
Laratrust doesn't use the authorization system that Laravel has built in. So they dont have/use the same level assignments like you find in the docs.
@zhacaitou7 жыл бұрын
By that, it doesn't really matter if i use singular or plural . right? thanks!
@JacurtisTutorials7 жыл бұрын
You can always override any names in Laravel, so in that way it doesn't matter. Following the conventions makes working with teams easier and keeps the community consistent. So i always follow those conventions in my tutorials. This is an exception because the modules, roles, and permissions you are reading about in the docs arent the same as the permissions and roles we are dealing with here, since its a third party plugin.
@zhacaitou7 жыл бұрын
Thanks a lot! Hi, BTW, I like your tutorials, you are the best!!
@dipeshmagar79577 жыл бұрын
You Are The Best !!!!!
@cobratst6 жыл бұрын
Could you please explain how to use *laratrust* with multiple user authentication
@mr.nobody33807 жыл бұрын
just curious to know has anyone run into a problem when running php artisan db:seed I'm getting the following error msg [BadMethodCallException] Call to undefined method Illuminate\Database\Query\Builder::hasPermission()
@JacurtisTutorials7 жыл бұрын
Try running "composer dump-autoload" in the terminal and try again.
@bechira7med7 жыл бұрын
Hey can someone help with this error when i run db:seed [parse error, syntax error, unexpected protected (T_protect), expect ',' or ';' or '}' And i don't know the file where the error exist
@zymawy7 жыл бұрын
You Should Use laratrust:seeder Not db:seed
@saudqureshi37166 жыл бұрын
hey Alex, will you please use Laravel file-manager and make a tutorial on it?. Please do it when you get time.
@christostsangaris47856 жыл бұрын
it's kinda funny to hear the phrase "role-model"!
@pappasgeorgios53485 жыл бұрын
Laravel 5.8 if you get an error running php artisan db:seed Call to undefined method Illuminate\Events\Dispatcher ::fire() In versions prior to Laravel 5.7, this method class name was fire but with Laravel 5.8, it is now dispatch. Replace fire with dispatch in \Your Project\vendor\santigarcor\laratrust\src\Traits\LaratrustHasEvents.php from protected function fireLaratrustEvent($event, array $payload) { if (! isset(static::$dispatcher)) { return true; } return static::$dispatcher->fire( "laratrust.{$event}: ".static::class, $payload ); } to protected function fireLaratrustEvent($event, array $payload) { if (! isset(static::$dispatcher)) { return true; } return static::$dispatcher->dispatch( "laratrust.{$event}: ".static::class, $payload ); }
@prakashale16277 жыл бұрын
I got this error :( [Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] No connection could be made because the target machi ne actively refused it. (SQL: select * from information_schema.tables where table_schema = devmark eter and table_name = migrations) [PDOException] SQLSTATE[HY000] [2002] No connection could be made because the target machi ne actively refused it.
@firstlast-gv2br7 жыл бұрын
you have to add the propper database name to your local enviremont ... means if you don't define already database name in .env file .if yes just create database with the same name and every thing will be ok
@ibedelandtsheer74936 жыл бұрын
Lil more help pls, been stuck here for hours...
@MarcelloPato6 жыл бұрын
Guys! After install laratrust via composer, run php artisan laratrust:setup and it will create models, etc.
@TamilTipsTVHealth7 жыл бұрын
I really follow your videos bro.. thanks you so much for your effects, I am an andriod developer but i have become web developer with your videos. Can you make some videos for search optimization
@JacurtisTutorials7 жыл бұрын
Yes eventually i do plan to.
@TamilTipsTVHealth7 жыл бұрын
Oh nice, thanks you... Datatables also a better option for the next video bro
@theaveragejoe897 жыл бұрын
Hi, do you have any plan to share only the HTML part for this project? :) Nice tutorial once again.
@JacurtisTutorials7 жыл бұрын
We will share it all. Everything is on github. Links in description.
@georgehoffman17627 жыл бұрын
Alex, you're having a problem with that "u" because you've got a tryst on your mind instead of trust!!! Ha ha. Don't let your sig o know that. Also, laratrust's auto setup feature in the current (as of Jan 8 2018) version is awesome, once you know what it's doing behind the scenes.
@vtvvnha22307 жыл бұрын
very exiting your new video :) +1
@VURGINN7 жыл бұрын
Liked 👍
@visualizemachinedata4 жыл бұрын
thanks
@irtezaasad78857 жыл бұрын
For those who faced this problem SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Solution here, laravel-news.com/laravel-5-4-key-too-long-error
@dieplien88537 жыл бұрын
thank
@1lucak17 жыл бұрын
Am I the only one who got the models already after running "php artisan laratrust:setup"??
@JacurtisTutorials7 жыл бұрын
Cool, i guess i missed this. Thanks for sharing
@1lucak17 жыл бұрын
DevMarketer Any idea why the models didn't got generated on your side? I checked the video twice and got no clue..
@firstlast-gv2br7 жыл бұрын
D:\LaravelProjects\gmao>php artisan migrate Migration table created successfully. In Connection.php line 664: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; m ax key length is 1000 bytes (SQL: alter table `users` add unique `users_email_unique` (`email`)) In Connection.php line 458: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; m ax key length is 1000 bytes
@firstlast-gv2br7 жыл бұрын
laratrust migration not showing in the database
@firstlast-gv2br7 жыл бұрын
'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8m4',// change this line to utf8 'collation' => 'utf8m4_unicode_ci',//also this line to match charset utf8_unicode_ci 'prefix' => '', 'strict' => true, 'engine' => null, ],
@voneatpen60607 жыл бұрын
For [ErrorException] Invalid argument supplied for foreach() Fixed: php artisan config:clear php artisan cache:clear run php artisan db:seed again
@mostafaadel75456 жыл бұрын
Thanks man
@robbradley13375 жыл бұрын
As a user of PHPStorm since 2013, it's painful to watch you use this IDE. Sorry, I had to get that off of my chest. :D
@amadousow65986 жыл бұрын
sorry they many think you don't do i advise follower to watch Laravel tutorieal ACL Academin for better undestand thx for job i know you try but you do many mistakes
@lawalhamisu15717 жыл бұрын
good day i keep on getting this error [Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected ';', expecting '{' and i have checked and everything seems correct but still this doesnt work
@kakolisaha9816 жыл бұрын
When I try to run the migration after creating the laratrust migration, then terminal say "Database [CMS] not configured." How I resolve it...
@christianelyong.s86965 жыл бұрын
I use laravel 6.0 laratrust 5.2 and I get error "Non-static method Laratrust\\Laratrust::can() should not be called statically". How i can solve this error? Thank U.