Fetch all models with field value of X
Sorry to ask such a basic question but I want to do the following....
I have a model called Work (and a WorkController and WorkRepository). On my Work module there is a field called "available" of type checkbox. Now i want to fetch all models with "available" selected.
I have a model called Work (and a WorkController and WorkRepository). On my Work module there is a field called "available" of type checkbox. Now i want to fetch all models with "available" selected.
- What is best practice to implement a e.g. getAllAvailable() method? Is that on the WorkRepository, WorkController of Work model class?
- How do I select all the models with that checkbox selected. In the laravel docs I saw this
but I can't seem to use the where function on my model. E.g. Work::where is not working.$flights = Flight::where('destination', 'Paris')->get();

