Interfaces and Traits: How to Use Them in Laravel Packages

preview_player
Показать описание
I will show you 3 examples of Laravel packages that have the same pattern of interface + trait used together. How does it work, and how can you use it in your projects?

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

Eu sou brasileiro e consigo entender definitivamente tudo o que você fala, sua didática e dicção são perfeitos, claramente o melhor canal sobre Laravel, ainda mais pra quem quer mantar uma boa prática com abstrações e afins

HelenaDuGraus
Автор

Is there any option to automatically like every video as soon as you publish them ? They are all very helpful

MartinBojmaliev
Автор

Great explanation in plain English, thank you!

RudiWebDeveloper
Автор

There is something that I think should be mentioned: normally you could use an abstract class (which has the code inside) to do something like this, BUT seen that every model already extends at least the Model class, you can't use an abstract class. That's why you have to use the combination of interface + trait. Am I right? ;)

IlPandax
Автор

Thanks to you, I now understand the deference extremely well.
Yesterday, Instead of implementing Like and Follow functionality within a test project, I used packages to provide the functionality for me.
Today's question: is it a bad practice to use a lot of packages?

hadidagher
Автор

thank you! I was really looking forward to this video :)

ivan_adamovich
Автор

Quite offtopic question: in a case of package, where you have some classes, how can we override that classes method? In a pratical example: webklex/laravel-pdfmerger has a known issue while mergin PDFs due to orientation. In the "how to" example is there just some lines on how to interact with that package, and one of that is create a class.

giacomogaravaglia
Автор

Yes i like this pattern i used in every projects i worked on it

elmarzougui
Автор

Trait is the implementation of interface 🥰

john.godstime
Автор

Great content.
Hi, in the ather hand, what's the different between scopes and pipelines ?
Thanks.

ouro-akpokhaled
Автор

Are the interfaces required?
Wouldn’t the traits work without the interfaces just as well?

JNL
Автор

Thank's sir😊
It would be nice if you share with us a mini mvc including
Routing system and middlewares

lahoucineoldakdim
Автор

The Interface define the rules of the trait

ricko
Автор

How to implement them in a Livewire package?

zainfarooq
Автор

Hello, Do you have any video on like your blog post "Restructuring a Laravel Controller using Services, Events, Jobs, Actions". if not can make one...I'm trying improve my self

aashiq_hasnat
Автор

hello sir, may i ask your help? i'm having trouble when i try to use admin template from tailwind css to my laravel project

akbarm
Автор

Hi, I have seen your this video
"How to Name Various Things"
and I want to know your personal preference for naming traits.
I understand it depends on the situation but I didn't get the reason for these prefixes and suffix for example
I have seen sometimes traits are named "HasSomething" e.g "HasFactory, HasMedia", or "Fooable", "Barable" and sometimes "UsedBySomething" etc

aamirsohailkmas