Member Since 6 Years Ago
4,365 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Replied to Livewire Components Rendor Method
thanks! I could have also done a trait, you're right.
Replied to Livewire Components Rendor Method
hilarious.. I forgot about OOP 101.
ClientsIndex and EmployeesIndex now extend ResourceIndex. The parent has no mount() method anymore, only declared properties and a render() method that passes those properties to a view.
The child classes (ClientsIndex, etc) have no render method, but only a mount() method that sets those parent properties.
Life is good again. :). Thanks for watching me trip over myself.
Started a new Conversation Livewire Components Rendor Method
Ok so i'm madly in love with Livewire, specifically components.. but also everything else.
In the rendor method, do you know if it's possible to return an actual Livewire component instead of a view?
I have two resources; Clients and Employees. Two Livewire components; ClientsIndex and EmployeesIndex. I created a third ResourcesIndex for abstraction purposes.
Currently, ClientsIndex render method returns a view('clients-index'). The same for EmployeesIndex. clients-index and employees-index views are virtually the same, they both call @livewire('resource-index') component but just have different models and meta data that get passed through.
I would like to remove those views 'clients-index' and 'employees-index' and have those components return the ResourceIndex component directly.
My work-around is that both ClientsIndex and EmployeesIndex components are returning 'resource-index' views, but that by-passes the ResourceIndex class, which I don't want - feels gross.
Thanks in advance!
Replied to Create Roles And Permissions In Laravel 8
I would simply add a field to your Users table is_admin and make it boolean, if you're only ever going to have two types. Having a User method IsAdmin() would be the only thing you'll ever need.
But if you want one level up from that, you can create roles and role_user tables, with the latter being the pivot for roles and users. I'm assuming that you know how to create and implement your own middleware. If not, I find the Laravel docs outstanding and use them daily. All you need to do then is create a route middleware class DoSomething and Gate::definition to make sure the $auth()->user()-can('do-something'); So a Gate definition in the AuthServiceProvider, DoSomething middleware class, route file reference ->middleware('do.something'), and register the DoSomething::class in the kernel.php.
I'm currently looking at diving into the spatie package myself because it looks way more robust, but there's definitely going to be a bit of a learning curve to implement it. But look at its usage, you can't beat its simplicity.
Commented on Jetstream
at 4:20, Jeffrey refers to a UpdatePasswordForm Livewire component. I cannot find this doing a search, nor can I if I browse. What am I missing? I did the vendor:publish command for the Jetstream views as shown, and now I've even done the vendor:publish for all of livewire, and i'm fearing unnecessarily.
Any help is appreciated. Thanks in advance.