I think he/she meant to create a repository class.
Your controller would look something like
<?php
use Vanpet\Repositories\AgendaRepositoryInterface;
class AgendaController extends Controller {
protected $agenda;
public function __construct(AgendaRepositoryInterface $agenda)
{
$this->agenda = $agenda;
}
public function show($year, $month, $day)
{
if($this->agenda->findByDate($year, $month, $day, Input::all()) {
return View::make('agenda.show', $agenda);
} else {
return View::make('error.page');
}
}
and then in your repository you would do all the stuff necessary to return the correct angenda(s)
Above might be a lot of info for a beginner but let me know if it makes sense.
Ok I will create a repository.
I fear I may have to come back for more help with the findByDate method, but that will be for later!
Thanks!
vanpet said:
Ok I will create a repository.
I fear I may have to come back for more help with the findByDate method, but that will be for later!
Thanks!
findByDate is your own method in the repository, you can name it whatever you like
Yeah, but it's the inside of that method that will be hard to code, I guess ;-)
vanpet said:
Yeah, but it's the inside of that method that will be hard to code, I guess ;-)
try to create an AgendaRepository, an AuthorRepository, a TagRepository and etc and then use your TagRepository in your AgendaRepository
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community