Single Table Inheritance in Laravel - Part 2
HTML-код
- Опубликовано: 17 июн 2021
- 👨💻 Learn Test-Driven Development with Laravel!
tddwithlaravel.com
Sign up to 30 Days of Laravel 👉🏻 30daysoflaravel.com
👨💻 Sign up to my newsletter and receive PHP, JS and Laravel news in a weekly-basis:
subscribe.mateusguimaraes.com
🎉 Party up:
/ mateusjatenee
/ mateusjatenee
/ mateusguimaraes
Thanks for watching!
Love it, makes me more willing to check the underlaying magic that Laravel provides. Thanks for the video!
you are the best, until now no one had explained this in much time and you did it super well, as well as the syntax of laravel. thanks for the video
Thanks for the education. Please what VS code extension did you used for code to indicate whether an argument in the function is a callback or scope and the likes. Am searching for the name of that extension. It's behaving as PHP storm and I like it. 😊😊
Sorry, I can't recall. I've been using PHPStorm for awhile.
ok its awesome and useful, but if we need some method or attribute specify for one Model we must add method for both model seems to interface of add "if block" to prevent error that other method dont have such method? i hope you understand what i mean. how to specify models and use specify method/attributes?
thanks for awesome video. I have a question:
5:35: the $attributes param only has "type" as key right?
If so, what is the point of passing that $attributes to `new $attributes['type']($attributes)`?
No, $attributes hold all of the model's attribute.s $attributes['type'] is a class string, e.g "App\Models\Doctor". We instantiate that object and pass all of the attributes as an argument.
@ but at 5:19 I noticed that you only passed ['type => $attributes['type'] ?? null] as first arg to `newInstance()`.
You're right -- at newInstance it only includes the type. I don't remember from the top of my head, but if it's a parent method, it's probably to retain the same signature.
Could you share the link to Caleb's package?
Kinda late, but it's called "Parental".
Salve Mateus, poderia ajudar os BR ruim no ingles ...rs