great calm explanation, thank you I am still learning the concept of repository design pattern , but I got a better picture now from your video writing the code live in front of the viewer , is really engaging , and I can see with the eyes of the developer how the thinking process goes and how to connect the project together and your pace is good and steady 👍
@amitavroydev
Жыл бұрын
Thanks for the great words. Glad to know you liked it. So subscribe 🙂
@omaryahia
Жыл бұрын
@@amitavroydev I subbed before finishing the video 😁👍
@amitavroydev
Жыл бұрын
Thank you
@CharlesDv
7 жыл бұрын
This is the best explanation of repository pattern implemented in Laravel. Well done! Thanks.
@amitavroydev
7 жыл бұрын
Thanks
@dunczyk1983
3 жыл бұрын
@@amitavroydev o
@sanjaiswar
3 жыл бұрын
Awesome and unique videos it was great learning
@amitavroydev
3 жыл бұрын
Thanks, good to know you liked it
@thehappyperson4125
6 жыл бұрын
This is the best implementation of repository pattern in laravel still in 2018
@amitavroydev
10 ай бұрын
thanks
@AhmedSaadSE
6 жыл бұрын
Thanks Bro, very good way to explain Repositories
@amitavroydev
10 ай бұрын
thanks
@waynecook6743
5 жыл бұрын
Hello, thank you for the tutorial. Question, why do we type hint the TodoRepository into the controller vs injecting the EloquentTodo?
@amitavroydev
5 жыл бұрын
Type hinting the TodoRepository is way of injecting the Interface. Basically what we are doing is creating a contract by creating the Interface TodoRepository. And then we create an implementation of that contract EloquentTodo. And then, in our AppServiceProvider, we bind the EloquentTodo class to the TodoRepository interface. Hence, Laravel know that it needs to pull EloquentTodo every place where we need the TodoRepository interface. Later, let's say if we change the EloquentTodo to MongoTodo. We only change the AppServiceProvider to let Laravel know that the implementation has changed and all instances will know and no code change is required.
@waynecook6743
5 жыл бұрын
@@amitavroydev Ah this makes sense to me now! I appreciate you taking time to help. Also I really enjoy your tutorials, thanks
@amitavroydev
5 жыл бұрын
Thanks all right. Giving back to the community and helping the community is why these videos are uploaded.
@jagdishchaudhary4762
7 жыл бұрын
very good way to teach...Thanks Lot
@amitavroydev
8 ай бұрын
Sorry for late reply Thanks for the comment
@detaaditya6237
6 жыл бұрын
Thank you! But i'd like to ask a question. If I can guarantee that my certain project would never switch database and orm (for example my project uses mysql and eloquent and they won't be switched out) should I still create a repository layer in the project?
@amitavroydev
6 жыл бұрын
Well although repository pattern helps in making app database agnostic, your question is valid that if my database doesn't change - should I use this pattern? Actually, you are the best judge of this question. If you feel your app is a simple blog app where you don't have many complex queries, not much code repeats etc then you should go with the normal approach. inside controller, using Eloquent models get the data. But, if your application is a little more than just a blog. Let's say it has a web and a mobile app then you will need to repeat a lot of logic in controllers. And that's where repositories can help you. In short, patterns are there to help but never over-engineer or do it just for the sake of doing it.
@georgetsakoumakos1766
5 жыл бұрын
Well done indeed! Your video(s) are clean.
@amitavroydev
5 жыл бұрын
Thanks
@aprprasanth8803
5 жыл бұрын
Thanks a lot brother...finally I found it
@amitavroydev
5 жыл бұрын
You are welcome
@amitduttjoshi
6 жыл бұрын
Why you have injected App\Repositories\TodoInterface; in TodoController instead of EloquentToDo class Please let me know. Thanks
@amitavroydev
6 жыл бұрын
Well, Amit that's how repositories work. I can inject EloquentTodo, but then if I have to change the implementation from Eloquent to something else then I have to go and change the instance in all instances (controllers) where I have used Eloquent. But, if I define in one place that all the instances of TodoInterface will use Eloquent todo and start injecting the Interface and not the implementation, then if I need to change the implementation, I will just change the definition in one place and I am done.
@khushalmore7678
4 жыл бұрын
Superb
@amitavroydev
4 жыл бұрын
Thanks
@KistlakRajapakshaSevenNet
5 жыл бұрын
100% Perfect !! Thank You very Much Bro !! :D
@amitavroydev
5 жыл бұрын
Welcome bro. Happy coding
@MukeshAshtekar
8 жыл бұрын
This is cool explaining, I would like to ask you if you can make videos for another patterns in laravel like : Facade, Factory, Singleton. It would be great if you explain these patterns in same todo app.
@amitavroydev
8 жыл бұрын
+Mukesh Ashtekar Well for that first I will have to understand them completely. Let me see... I will find time and get hold of them as well and then I can look at doing some videos on them as well.
@MukeshAshtekar
8 жыл бұрын
+Amitav Roy I am learning too. I could not understand well why exactly they are using that patterns. I understood your explained repository pattern completely. Hope you will get some time and understand that too and create videos like these ahead.
@inderjitsingh9634
5 жыл бұрын
Will you plz tell me why we need repository pattern we can directly access all static methods of a model in a controller
@amitavroydev
5 жыл бұрын
Patterns are used to slim your controllers and have your business logic inside individual classes. That's where you need them. In large applications, I never prefer having my business logic inside controller
@inderjitsingh9634
5 жыл бұрын
@@amitavroydev i got it thanks
@jochemgruter6393
6 жыл бұрын
thanks for your nice explanation!
@amitavroydev
10 ай бұрын
welcome
@samratkhan7095
6 жыл бұрын
@Amitav Roy... Some viewers doesn't know Repository Pattern Layer properly. You should mention that prior on video before go directly to the code. Some viewers know repositories as Git (like me). Why you creating a new layer in between Model? You should explain that and don't forget to mention the benefits to use repositories. Good work though. (y)
@samratkhan7095
6 жыл бұрын
Check Jeffrey Way tutorial in Laracasts. there are an explanation about repository too.
@amitavroydev
10 ай бұрын
Okay will keep in mind
@MrShashankTube
5 жыл бұрын
I see this pattern now doesn't work with laravel 5.7 ? i tried to call $this->model->all() but it it not working now..!! It cannot access static method inside model.
@amitavroydev
5 жыл бұрын
Should not be a problem. The error which you are seeing is very much like a php error. Can you share the code?
@deep433
4 жыл бұрын
$this->findById($id) not working for me on TodoRepostitory
@amitavroydev
4 жыл бұрын
Oh, it's a straightforward code. Should work. If you are still having problem, try sharing the code.
@100gbps2
5 жыл бұрын
thank you u saved my life today :D
@amitavroydev
5 жыл бұрын
Good to know this tutorial was useful to you. Happy coding and subscribe to my channel if you have not done it already :)
@2581877
5 жыл бұрын
Hey, am new to laravel, and I have some questions... For me it works everything even if dont specify every method in interface class. Is this normal? Also, i dint bind interface and implementation in serviceProvider and it still works... Am little confused about workfow of this pattern in laravel...
@amitavroydev
5 жыл бұрын
The binding is required if you do a dependency injection. Like if you inject the repository in some controller, you will inject the interface. That time, binding is required.
@amitavroydev
5 жыл бұрын
Need to see the code to understand better.
@schnullertroll4173
6 жыл бұрын
I have a BaseRepository class with methods which will be valid for all Models. The only problem is, that the User model is derived from use Illuminate\Foundation\Auth\User. So it throws me a type error because the constructor requires an instance of Illuminate\Database\Eleoquent\Model. How can I solve the problem? Here is my UserRepository.php: namespace App\Repositories\User; use App\Model\User; use App\Repositories\Base\BaseRepository; class UserRepository extends BaseRepository { public function __construct(User $user) { parent::__construct($user); } }
@amitavroydev
10 ай бұрын
archiving
@fahimbakhtiar
7 жыл бұрын
can you please explain why did we need the todo interface at the first place?
@amitavroydev
7 жыл бұрын
The main reason is to have a consistency in all the implementations. So mysql and mongo Repository should implement all these methods or else the application may break. Plus if we do that Interface then we inject the interface and not the implemented class which means if at any point we need to change the implementation from Eloquent to something else, it's a change only in the service provider where we are registering them.
@fahimbakhtiar
7 жыл бұрын
so this is the main intention behind repository pattern! okay! thanks your video is well explained. could you please do a video on domain driven design with laravel, it'd be a help. thanks again.
@NishantKumar-ju7qi
4 жыл бұрын
i think need to add two lines in EloquentTodo.php :- use App\Todo; use App\Repositories\TodoInterface; am i right ...?? and it's Awesome Tutorial.
@amitavroydev
4 жыл бұрын
Yes, that is correct. They will need to be imported.
@crazyweedude
7 жыл бұрын
Great tutorial
@amitavroydev
7 ай бұрын
thanks
@NguyenThanh-lz7bq
4 жыл бұрын
pls help me. Class App\Http\Controllers\CategoryRepository does not exist
@amitavroydev
10 ай бұрын
solved?
@NguyenThanh-lz7bq
10 ай бұрын
@@amitavroydev it's ok
@TariqSajid
8 жыл бұрын
make a ecommerce project tutorial with shopping cart with ajax please :)
@amitavroydev
8 жыл бұрын
+Tariq Sajid Ha ha.. it's not a one man job. Why don't you start on Github... I will collaborate.
@cliffondmello8326
8 жыл бұрын
I'm getting this error when i tried following this example,could anyone please help FatalErrorException in PeopleController.php line 26: Call to a member function getAll() on null
@amitavroydev
8 жыл бұрын
Need to see PeopleController to understand why this error is coming.
@cliffondmello8326
8 жыл бұрын
+Amitav Roy have solved error
@amitavroydev
8 жыл бұрын
+cliffon dmello good to hear
@phuongdang6537
7 жыл бұрын
Hello! How did you solve the problem! I also have the same error as you but have not found the problem
@adarshchacko6137
3 жыл бұрын
What is the advantage of doing this ?
@amitavroydev
3 жыл бұрын
this kind of pattern comes very handy when you are working with having different ways of sending emails using different drivers. or let's say your application communicate with Survery tools to get certain kind of content. And at that point, you will have an Interface which the Controllers will call to get data or query data. And, with this pattern you are able to have different service provider.
@lakhmanbhutiya
5 жыл бұрын
Thank you!
@amitavroydev
5 жыл бұрын
Welcome
@falahapp
8 жыл бұрын
can you make a tutorial where you use repository for caching
Пікірлер: 87