Spatie Laravel Permission: Example Project Review

  Рет қаралды 53,203

Laravel Daily

Laravel Daily

Күн бұрын

Пікірлер: 68
@schoolfaqs
@schoolfaqs 3 жыл бұрын
I love this package. I've used it in 4 different production projects.
@tranong142
@tranong142 3 жыл бұрын
yes, me too,. i've use it in 2 large project. that is the best packages of Spatie. They has many useful packages
@zakiarahmoune7458
@zakiarahmoune7458 2 жыл бұрын
What is the difference by Spatie & authentication by Laravel ui please,
@o_lobato
@o_lobato 3 жыл бұрын
In fact, the "hack" to grant permissions to "Super Admin" is advised and explained in the docs of Spatie Laravel Permission
@turdakhov
@turdakhov Жыл бұрын
Thank you! We love your videos and thoughs!
@blog4lives
@blog4lives 3 жыл бұрын
Could you maybe make a video about the new Teams permission feature in the spatie-permission package?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
New feature? Can you give me a link to some info about the release of it?
@ernestofavio6735
@ernestofavio6735 Жыл бұрын
@@LaravelDaily pls do it :c
@localusercamp
@localusercamp Жыл бұрын
Nice tutorial, very clear and understandable. Что думаете на счет того, чтобы вынести все эти строки в константы и использовать уже их а не писать везде строки?
@turdakhov
@turdakhov Жыл бұрын
Можно и в константы. Строки по сути не супер длинные и их ассортимент не большой, можно и так печатать. Но в IDE с константами будет легче работать - меньше шансов опечататься.
@ernestofavio6735
@ernestofavio6735 Жыл бұрын
Whats the differencia of using middlewares in the controller rather than Gates like in the video ? I mean, the first protects de routes, and the other only provides if the user has authorization, right ?
@khanhvu8119
@khanhvu8119 2 жыл бұрын
so touching for an excellent video
@josuebarros-desenvolvedorw2490
@josuebarros-desenvolvedorw2490 3 жыл бұрын
Thanks a lot Povilas!!! Do you plan or recording about FILAMENT ADMIN???
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Yes I have one project in review queue which uses Filament, but for now I'm not sure whether my review would be useful. We'll see
@josuebarros-desenvolvedorw2490
@josuebarros-desenvolvedorw2490 3 жыл бұрын
@@LaravelDaily this is awesome!!!
@СтаниславЧетвериков-з2м
@СтаниславЧетвериков-з2м 3 жыл бұрын
Очень полезно и жизненно! Спасибо)
@syakirinamin2788
@syakirinamin2788 3 жыл бұрын
what about multiple model
@ernestofavio6735
@ernestofavio6735 Жыл бұрын
I love you man, thanks a lot.
@abdelrahmanhazem6320
@abdelrahmanhazem6320 Жыл бұрын
why cann't find seeder files ??
@jovincebrillantes1042
@jovincebrillantes1042 3 жыл бұрын
The fk. I wish I heard about this package a few months ago. It would've saved my ass from hrs. of debugging.
@tim.bogdanov
@tim.bogdanov Жыл бұрын
im getting the "there is no permission named ....." has anyone else come across this when trying to seed?
@bernielorbis4364
@bernielorbis4364 3 жыл бұрын
What database client you are using sir?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Table Plus
@mohammadmohammadi2724
@mohammadmohammadi2724 3 жыл бұрын
Thanks a lot to introduce these packages How can we send our projects yo review?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Yes but I have a queue now so realistically I can take new projects for review in September.
@sulaimanmisri9570
@sulaimanmisri9570 3 жыл бұрын
Hi, can you also make a video for laratrust?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
There's Laratrust and Bouncer, which work in a very similar way. Not sure if my video would add something useful more than this video about Spatie permission as example, and more than official docs of those packages.
@amrullahdev8895
@amrullahdev8895 3 жыл бұрын
$this->authorize() didnt work when we use api
@nurbolatnurlanuly
@nurbolatnurlanuly 3 жыл бұрын
Thank you teacher 🙂🙌🏻
@cuc_vlogs
@cuc_vlogs 3 жыл бұрын
thanks you
@GergelyCsermely
@GergelyCsermely 3 жыл бұрын
Thanks
@cethartest469
@cethartest469 3 жыл бұрын
thanks, what if changed table name from user to admin, how can work with this packag
@rolandosanches2344
@rolandosanches2344 3 жыл бұрын
The package allow you to rename the tables. Just publish the config and change it.
@MatejSK1
@MatejSK1 2 жыл бұрын
I would like to ask how it exactly works: How is the role connected with user table ? In example: I have already existing table users with all users, do I have to create any column which has to be connected with table "roles" from the spatie package, or its somehow directly connected with roles table just thanks to that trait line code in model ?
@LaravelDaily
@LaravelDaily 2 жыл бұрын
Yes it's directly connected to that trait. For more details, read the docs of the package.
@MatejSK1
@MatejSK1 2 жыл бұрын
@@LaravelDaily oh thank you for fast answer, I am glad that I dont have to create anything new in my already existing database and I just have to use that Trait line in my model there :)
@hajerghinnewah8698
@hajerghinnewah8698 2 жыл бұрын
omg i love you all my proplem solved by you
@ArislanHaikal
@ArislanHaikal 3 жыл бұрын
Why permissions and roles cache not working? after get user with permission or roles, always query from db. I need caching this
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Not sure if caching is a good choice here, because what if roles/permissions have changed since last request of the user? I prefer to get the permissions in live mode, and I'm ok with a few quick DB queries for it.
@ArislanHaikal
@ArislanHaikal 3 жыл бұрын
@@LaravelDaily some issue here github.com/spatie/laravel-permission/issues/1674 . You can help?
@Farishrf
@Farishrf 3 жыл бұрын
​@@LaravelDaily Good point I think Spatie doesn't cache all things (3 Queries get to run on each page), but for the rest, Spatie permission package automatically refreshes the cached data if you change any permission. Reference: github.com/spatie/laravel-permission/blob/master/src/Traits/RefreshesPermissionCache.php
@Avefenixfuego8
@Avefenixfuego8 3 жыл бұрын
Great, I have integrated Jetstream with spatie, all right but only one problem with roles of spatie not working when show the profile page of Jetstream livewire. I have created two roles: Admin and User, and I have created too Roleseeder with permission and roles for all page and profile, but profile page not working with spatie and "User" role show error 404,what's going on? Do you have one idea? Thanks
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Can't answer in a short KZbin comment, without debugging with your full project code
@Avefenixfuego8
@Avefenixfuego8 3 жыл бұрын
@@LaravelDaily I have already solved the problem, it was specifically generating jetstream in the following route, you can change the url: your-project\vendor\laravel\jetstream outes\livewire.php
@karimchatoine6818
@karimchatoine6818 3 жыл бұрын
Thanks a lot Povilas. I have a problem with spatie permission in resource routes, I can't define each route with specific permission do you please have any idea how to set the permission for resource routes in web.php NB : i know i can Defined them in controller constructor but i'm preferring to find a way in web.php Thank you in advance
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I haven't set permissions in route resource myself. So no advice, sorry.
@sahin8649
@sahin8649 2 жыл бұрын
Have you solved the problem? I'm thinking of using the package and concerned about resource routes too. But isn't it a good idea to use check roles in web.php and check the specific permissions in the method of that resource controller. Let's say we have 'user', 'author' and 'admin' roles. Authors and admins can see the posts in the admin panel but only admins can delete. I think we limit that with 'author' and 'admin' in the web.php so users can't get in the admin/posts page. And then we check the permission of 'post_edit' in the edit and create methods. It's just a quick idea. Please leave your comments about that.
@karimchatoine6818
@karimchatoine6818 2 жыл бұрын
@@sahin8649 Hello, exactly this is what i did to solve it. I checked the permission in method of that controller.
@6542fahad
@6542fahad 2 жыл бұрын
Thanks , clearly explained
@hosamgnaba3205
@hosamgnaba3205 3 жыл бұрын
nice viedoe thank you
@yungifez
@yungifez 3 жыл бұрын
I went through the docs but I have a question Let's say we have ability to create schools And we can add admin to that school Now how do you check if an admin is trying to change something that belongs to another school I'll probably make a function like Public static function($school_id){ return auth()->user()->school === $school_id; } Is there any way to achieve this
@rosselliot8971
@rosselliot8971 2 жыл бұрын
The Spatie package also contains Teams as well as Roles, so a User can belong to a Team. So, create a Team for the school and assign users to that Team/School.
@yungifez
@yungifez 2 жыл бұрын
@@rosselliot8971 too late 🤣🤣
@vitouvitou5269
@vitouvitou5269 3 жыл бұрын
💖💖
@rob5393
@rob5393 3 жыл бұрын
Really helpful. Thanks :)
@dfordemo981
@dfordemo981 3 жыл бұрын
great
@ehsanraoufi7005
@ehsanraoufi7005 2 жыл бұрын
hello sir thanks for this video i want to add tdd in my project with spatie but when i want to add code and test i get this error Class "Spatie\Permission\PermissionRegistrar" not found did you have any solution or video for this problem . how i gave role to my user in tdd.
@JamesAutoDude
@JamesAutoDude Жыл бұрын
Teams is so dang confusing for me :(
@elrbybark
@elrbybark 3 жыл бұрын
any idea how to make this code cleaner? public function query(Order $model) { return $model->newQuery() ->where('client_id', $this->client->id) ->with(['details:id,order_id,product_id', 'details.product:id,main_image_id', 'details.product.image']); $visibleStatuses = []; // statuses are: completed, pending, accepted, canceled foreach (OrderStatus::asArray() as $value) { if (Auth::user()->can('view ' . strtolower($value) . ' orders')) { array_push($visibleStatuses, $value); } } $query->whereIn('status', $visibleStatuses); return $query; }
Laravel Roles and Permissions: All CORE Things You Need To Know
16:32
Laravel Daily
Рет қаралды 225 М.
Introducing spatie/laravel-data
21:17
Freek Van der Herten
Рет қаралды 10 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,4 МЛН
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 89 МЛН
Why Don't We Have A Laravel For JavaScript?
12:36
Theo - t3․gg
Рет қаралды 110 М.
Laravel Filament Roles and Permissions Full Tutorial
1:50:41
Tony Xhepa
Рет қаралды 37 М.
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
Laravel Security: Top 7 Mistakes Developers Make
11:16
Laravel Daily
Рет қаралды 86 М.
Laravel Octane: supercharge your Laravel applications
8:34
Aaron Francis
Рет қаралды 47 М.
The Tools I Use to Build Products in Laravel
19:00
Josh Cirre
Рет қаралды 39 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 143 М.
Authorization in Laravel: Can You Do That?
8:29
Laravel
Рет қаралды 10 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2 МЛН