Member Since 2 Years Ago
4,100 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 Limit User Records
Ok i looked into it and still not what I need. I mean limit user records as in the number they are allowed to create. Not simply allowing access inside the store method.
Getting to the store method has FormRequest so it still wastes all that going thru validation overhead to simply get inside the store method then say sorry you have 10 records you cant make any more. I want to pre-emptive check prior to hitting the store method if the user has 10 records simply throw exception, if less than 10 allow to hit the store method. Looks like middleware since it acts prior to the method its-self.
Replied to Limit User Records
Thanks, I will give the policies a try and see how that goes.
Right now the controller allows the user to create records no problem, I simply want to block access to the store method if they have reached the max allowed.
Controller follow standard CRUD but currently the routes / entire controllers are completely protected via middleware so I am not sure that $this-authorizeResource() is needed but perhaps could be useful.
Started a new Conversation Limit User Records
I was wondering what is the best way to handle this situation.
A User depending on their "status" is allowed x number of records to be created. Now I am currently doing this in the controller store method, but this means it has to go thru FormRequest / Validation and all that only to tell user you have reached max number. Sure on front end I can simply not show the form, as this is an API request a smart user could simply use Postman to submit a form so I was thinking policies/ gates to stop the request before it even hits the store method.
But as I have never used Policies/ Gates I was wondering if this is the best way and if so any insight to get started?
Replied to Polymorphic View Assistance
Thanks, I was thinking of adding a you suggested so each Model would be assigned a partial so use that as your snip shows to provide what partial to use based on the reviewable_type without having to really do much extra.
Started a new Conversation Polymorphic View Assistance
I am building a Reviewable function simply when user add / edit certain parts of their account some of the sections of the account are "reviewable" by moderators. So upload new pictures they are reviewable, new post, same idea.
So I have my reviewables table saving as it should for these actions as needed, I can thru testing and logging see the morphed relationship data but since the records all have different columns how do you return a view / blade to display on a page to properly review. Media has a url basically i need to view the uploaded image and approve or reject it, Post has a title, category_id, description, and so on for the different reviewable types. Is it like make a partial for each and in a forech based on the model render a partial for that specific reviewable item?
How would / do you approach it?