Configuring Laratrust - Build an Advanced Blog/CMS (Episode 10)

  Рет қаралды 33,065

DevMarketer

DevMarketer

Күн бұрын

Пікірлер: 97
@eazydotme4619
@eazydotme4619 6 жыл бұрын
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 )
@hidajettuzlak6393
@hidajettuzlak6393 7 жыл бұрын
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
@volikoto
@volikoto 7 жыл бұрын
Thanks but how did you know?
@voneatpen6060
@voneatpen6060 7 жыл бұрын
check this link you will know. laratrust.readthedocs.io/en/5.0/configuration/models/role.html
@qwerty-gf5fz
@qwerty-gf5fz 7 жыл бұрын
this took me an ages to figure out. thanks for the info!
@raymondmichael4987
@raymondmichael4987 7 жыл бұрын
Thanks man; I lost 20min trying to figure it out
@Mightyowlzx
@Mightyowlzx 7 жыл бұрын
Thanks.
@NickyKeyse
@NickyKeyse 7 жыл бұрын
Another top video, very interesting. Thanks for the Laratrust tutorial. All that's missing is you - good luck with the hub.
@oyewodayo
@oyewodayo 7 жыл бұрын
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
@juanrincon6576
@juanrincon6576 7 жыл бұрын
Yes sir, another episode!
@ricabomfim
@ricabomfim 5 жыл бұрын
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.
@ricabomfim
@ricabomfim 5 жыл бұрын
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
@zymawy
@zymawy 7 жыл бұрын
When I'm Using Authorization I Don't Multi Auth Right For Example I Don't To Make Admin Model ?
@samdeacon7910
@samdeacon7910 6 жыл бұрын
This series is frickin awesome!
@vardgeskeshishyan380
@vardgeskeshishyan380 7 жыл бұрын
How can help me, I catch an error [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Laratrust\LaratrustRole' not found;
@vardgeskeshishyan380
@vardgeskeshishyan380 7 жыл бұрын
Ohhhhhh i understand already, instead of Laratrust\LaratrustPermission must be Laratrust\Models\LaratrustPermission
@ibedelandtsheer7493
@ibedelandtsheer7493 6 жыл бұрын
thank you sir!
@TheChaoticTranquil
@TheChaoticTranquil 7 жыл бұрын
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-j4n
@agil-j4n 7 жыл бұрын
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
@jasonwitt95
@jasonwitt95 7 жыл бұрын
So what made you decide to use Laratrust right after you just did your Multiple Authentication series?
@christostsangaris4785
@christostsangaris4785 6 жыл бұрын
So Jason, what is your conclusion after 1 year? Native multi-auth or Laratrust?
@oldfishergaming
@oldfishergaming 7 жыл бұрын
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.
@oldfishergaming
@oldfishergaming 7 жыл бұрын
Problem sorted finally Remove mb4 from charset and collation from config/database.php, then it will execute successfully. 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci',
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
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ر 7 жыл бұрын
CryptoMonkey utf8 general_ci for all language Thank you thats help me
@CodeCampus-kv6ui
@CodeCampus-kv6ui 5 жыл бұрын
sir which theme are you using for vscode
@teyimpila7510
@teyimpila7510 7 жыл бұрын
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.
@aremoisaac4338
@aremoisaac4338 7 жыл бұрын
[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'App\User' not found when i run php artisan db:seed am running laravel 5.5
@christostsangaris4785
@christostsangaris4785 6 жыл бұрын
@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!
@allaghi
@allaghi 7 жыл бұрын
You can use ( php artisan laratrust:setup ) command to let laratrust to setup by itself.
@bartukocakara7794
@bartukocakara7794 4 жыл бұрын
I am getting Target LaratrustSeeder does not exist error mine infos are just like yours. But why this keep failing ?
@bartukocakara7794
@bartukocakara7794 4 жыл бұрын
adding namespace Database\Seeders; in LaratrustSeeder.php solved id
@aditiawidyanto3749
@aditiawidyanto3749 7 жыл бұрын
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)
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
Check your syntax. It says unexpected end of file, so you probably missed a semi colon or curly brace somewhere.
@prakashale1627
@prakashale1627 7 жыл бұрын
Dude! I had a same problem but when I checked there was a one more closing big bracket before 'permissions_map'
@Epsonworkforcewf7710
@Epsonworkforcewf7710 7 жыл бұрын
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?
@Kobistas
@Kobistas 7 жыл бұрын
Delete tables and run migration again.
@visitasia7404
@visitasia7404 7 жыл бұрын
did you use with your production ? it's not recommend!
@firstlast-gv2br
@firstlast-gv2br 7 жыл бұрын
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.
@juanalbertovallecardenas3212
@juanalbertovallecardenas3212 7 жыл бұрын
Great Alex!!! Thanks you for the class :)
@zhacaitou
@zhacaitou 7 жыл бұрын
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!
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
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.
@zhacaitou
@zhacaitou 7 жыл бұрын
By that, it doesn't really matter if i use singular or plural . right? thanks!
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
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.
@zhacaitou
@zhacaitou 7 жыл бұрын
Thanks a lot! Hi, BTW, I like your tutorials, you are the best!!
@dipeshmagar7957
@dipeshmagar7957 7 жыл бұрын
You Are The Best !!!!!
@cobratst
@cobratst 6 жыл бұрын
Could you please explain how to use *laratrust* with multiple user authentication
@mr.nobody3380
@mr.nobody3380 7 жыл бұрын
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()
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
Try running "composer dump-autoload" in the terminal and try again.
@bechira7med
@bechira7med 7 жыл бұрын
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
@zymawy
@zymawy 7 жыл бұрын
You Should Use laratrust:seeder Not db:seed
@saudqureshi3716
@saudqureshi3716 6 жыл бұрын
hey Alex, will you please use Laravel file-manager and make a tutorial on it?. Please do it when you get time.
@christostsangaris4785
@christostsangaris4785 6 жыл бұрын
it's kinda funny to hear the phrase "role-model"!
@pappasgeorgios5348
@pappasgeorgios5348 5 жыл бұрын
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 ); }
@prakashale1627
@prakashale1627 7 жыл бұрын
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-gv2br
@firstlast-gv2br 7 жыл бұрын
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
@ibedelandtsheer7493
@ibedelandtsheer7493 6 жыл бұрын
Lil more help pls, been stuck here for hours...
@MarcelloPato
@MarcelloPato 6 жыл бұрын
Guys! After install laratrust via composer, run php artisan laratrust:setup and it will create models, etc.
@TamilTipsTVHealth
@TamilTipsTVHealth 7 жыл бұрын
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
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
Yes eventually i do plan to.
@TamilTipsTVHealth
@TamilTipsTVHealth 7 жыл бұрын
Oh nice, thanks you... Datatables also a better option for the next video bro
@theaveragejoe89
@theaveragejoe89 7 жыл бұрын
Hi, do you have any plan to share only the HTML part for this project? :) Nice tutorial once again.
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
We will share it all. Everything is on github. Links in description.
@georgehoffman1762
@georgehoffman1762 7 жыл бұрын
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.
@vtvvnha2230
@vtvvnha2230 7 жыл бұрын
very exiting your new video :) +1
@VURGINN
@VURGINN 7 жыл бұрын
Liked 👍
@visualizemachinedata
@visualizemachinedata 4 жыл бұрын
thanks
@irtezaasad7885
@irtezaasad7885 7 жыл бұрын
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
@dieplien8853
@dieplien8853 7 жыл бұрын
thank
@1lucak1
@1lucak1 7 жыл бұрын
Am I the only one who got the models already after running "php artisan laratrust:setup"??
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
Cool, i guess i missed this. Thanks for sharing
@1lucak1
@1lucak1 7 жыл бұрын
DevMarketer Any idea why the models didn't got generated on your side? I checked the video twice and got no clue..
@firstlast-gv2br
@firstlast-gv2br 7 жыл бұрын
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-gv2br
@firstlast-gv2br 7 жыл бұрын
laratrust migration not showing in the database
@firstlast-gv2br
@firstlast-gv2br 7 жыл бұрын
'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, ],
@voneatpen6060
@voneatpen6060 7 жыл бұрын
For [ErrorException] Invalid argument supplied for foreach() Fixed: php artisan config:clear php artisan cache:clear run php artisan db:seed again
@mostafaadel7545
@mostafaadel7545 6 жыл бұрын
Thanks man
@robbradley1337
@robbradley1337 5 жыл бұрын
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
@amadousow6598
@amadousow6598 6 жыл бұрын
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
@lawalhamisu1571
@lawalhamisu1571 7 жыл бұрын
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
@kakolisaha981
@kakolisaha981 6 жыл бұрын
When I try to run the migration after creating the laratrust migration, then terminal say "Database [CMS] not configured." How I resolve it...
@christianelyong.s8696
@christianelyong.s8696 5 жыл бұрын
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.
Configuring Laratrust - Build an Advanced Blog/CMS (Episode 11)
23:15
Early FAQ's - Build an Advanced Blog/ CMS from Start to Finish
23:30
Какой я клей? | CLEX #shorts
0:59
CLEX
Рет қаралды 1,9 МЛН
Air Sigma Girl #sigma
0:32
Jin and Hattie
Рет қаралды 45 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
[Live-Coding] Refactor Laravel Controller to be Much Shorter
14:55
Laravel Daily
Рет қаралды 78 М.
Starting the Code! - Building an Advanced Blog/CMS (Episode 7)
28:27
Faulty Ubiquiti POE Network Switch | Can I Fix It?
31:22
Buy it Fix it
Рет қаралды 45 М.
An Illustrated Guide to OAuth and OpenID Connect
16:36
OktaDev
Рет қаралды 627 М.
User CRUD - Build an Advanced Blog/CMS (Episode 12)
40:08
DevMarketer
Рет қаралды 26 М.
LSP in Neovim. Thanks to BILL GATES?! | FREE COURSE // EP 3
17:51
Какой я клей? | CLEX #shorts
0:59
CLEX
Рет қаралды 1,9 МЛН