Nice video. When using Laravel people seem to forget that Laravel is PHP and end up don't learning OOP or "pure PHP" (mostly because it's kinda easy to use Laravel without much knowledge of PHP). That's something I don't like, even tho I'm learning Laravel I feel the need to learn more about pure PHP and OOP in general
Given PHP's limit of extending from only one class, you can't rely on on abstract class, necessarily, if you're providing code to be used by others (such as open source packages). it seems common to define an interface with the methods required, and include a trait that defines those methods. I found this confusing at first, but very helpful to add functionality while working around the one-class extends limit.
So, as i understand, interface would be good for situation when i need to process payment. One interface and several payment provider classes will be implementing that interface. Also later i will be able to add just another payment provider class and it will work with present interface. Right? It's like USB, you can connect different devices to it, and they will work normally because they implement this USB interface.
Thanks for the video! It also can be great to see some videos like “middle” level of difficulty. For example something about compare ORM and CQRS. Or maybe some explanation about concepts of DDD
For now, I'm focused on practical topics and not theoretical concept comparison. Maybe, when I run out of practical topics, I'll switch to the philosophy on this channel :)
@@igoreksazonov yes till now I have been using with that mindset only. But in some good repos I've noticed in some places abstract classes are used and some places interfaces. I only have difference with respect to inheritance. Using abstract class we restrict extend with that class whereas in case of interface there can be many interfaces implemented.
Abstract classes do offer some functionality, its not just structure, its the actual functionality with something in already. Interfaces offer only and only description of what the class should be capable of, we cannot give it any real properties or functionality, just a shared set of methods
Can be named “API”. Its more natural above Interface and Contract. API provides a contract for another service. So contract and API is the same thing, but i’m below API term is already used in hardware and software like a standard, not needing new term like contract.
Oh, OOP is already here) Cool, well then you should take into account that there are also abstract classes. It's just difficult to rebuild your logic in order to start using all this, although the advantages are immediately felt. And looks like interfaces should be named like gates or politicians? liked the topic of using oop in laravel
I noticed that the author used this function to name his file: $filename = uniqid().'_'.Str::random(30) . ".png"; => if you loop through 10 files and using above function to name your file, is there any chance that you would get duplicate file name?
User hasMany(cities) City hasMany(Users), hasMany(Restaurants) Restaurants belongsTo(City) Orders belongsTo(Restaurants) now there are city wise admins. admins can see orders of their assigned cities only with global scopes to other cities records . How to create this relationships.
Nice video. When using Laravel people seem to forget that Laravel is PHP and end up don't learning OOP or "pure PHP" (mostly because it's kinda easy to use Laravel without much knowledge of PHP). That's something I don't like, even tho I'm learning Laravel I feel the need to learn more about pure PHP and OOP in general
Given PHP's limit of extending from only one class, you can't rely on on abstract class, necessarily, if you're providing code to be used by others (such as open source packages). it seems common to define an interface with the methods required, and include a trait that defines those methods. I found this confusing at first, but very helpful to add functionality while working around the one-class extends limit.
thank you for the best explanation about contracts in laravel.
I was struggling to understand interface and this video gave me a better understanding. Thank you ❤️
There are still abstract classes awaiting you, which will only create more confusion. )
So, as i understand, interface would be good for situation when i need to process payment. One interface and several payment provider classes will be implementing that interface. Also later i will be able to add just another payment provider class and it will work with present interface. Right?
It's like USB, you can connect different devices to it, and they will work normally because they implement this USB interface.
Thats a good explanation!
Thanks for the video! It also can be great to see some videos like “middle” level of difficulty. For example something about compare ORM and CQRS. Or maybe some explanation about concepts of DDD
Also websockets
For now, I'm focused on practical topics and not theoretical concept comparison. Maybe, when I run out of practical topics, I'll switch to the philosophy on this channel :)
Now I understand it better.
thanks
I always have trouble deciding to use either interface or abstract class. Can you please help with this confusion.
Ok adding the interface and abstract classes to the to-do list.
its up to your mind
@@igoreksazonov yes till now I have been using with that mindset only. But in some good repos I've noticed in some places abstract classes are used and some places interfaces. I only have difference with respect to inheritance. Using abstract class we restrict extend with that class whereas in case of interface there can be many interfaces implemented.
Abstract classes do offer some functionality, its not just structure, its the actual functionality with something in already.
Interfaces offer only and only description of what the class should be capable of, we cannot give it any real properties or functionality, just a shared set of methods
Thanks for posting
Can be named “API”. Its more natural above Interface and Contract.
API provides a contract for another service. So contract and API is the same thing, but i’m below API term is already used in hardware and software like a standard, not needing new term like contract.
Thank sr for share
Thank u 🙏
Dependency inversion FTW. 🙌
Oh, OOP is already here) Cool, well then you should take into account that there are also abstract classes. It's just difficult to rebuild your logic in order to start using all this, although the advantages are immediately felt. And looks like interfaces should be named like gates or politicians? liked the topic of using oop in laravel
Ok adding the interface and abstract classes to the to-do list.
Laravel is PHP OOP mostly..... Just saying.
I have got a question. Is it possible to have the CanCaptureScreenshot binding with both classes in the service provider?
Why would you need that? How would Laravel then know which class to run?
thank you, sir..
I noticed that the author used this function to name his file: $filename = uniqid().'_'.Str::random(30) . ".png";
=> if you loop through 10 files and using above function to name your file, is there any chance that you would get duplicate file name?
Show de Bola!
User hasMany(cities)
City hasMany(Users), hasMany(Restaurants)
Restaurants belongsTo(City)
Orders belongsTo(Restaurants)
now there are city wise admins. admins can see orders of their assigned cities only with global scopes to other cities records .
How to create this relationships.
❤😍
basically, php is like java in this regards
We should say both of them follow OOP, even like c# LOL
interface is the opposite of trait, instead of being provided with methods you have to implement them yourself.
You don't say 😂
The interface for the relationship is pointless. It’s just adding more complexity than is needed.
first viewer :D
Firster then video duration)