I want to know if I'm going about creating and calling two functions from my model to my controller in the simplest and cleanest way.
Model:
public function getPosts()
{
$post = $this->paginate(4);
return $post;
}
public function getMonth($post)
{
$post->month = date('M', strtotime($this->created_at));
$post->month = strtoupper($post->month);
return $post->month;
}
public function getDay($post)
{
$post->day = date('d', strtotime($this->created_at));
return $post->day;
}
Controller:
public function index()
{
$post = $this->post->getPosts();
$post->month = $this->post->getMonth($post);
$post->day = $this->post->getDay($post);
return View::make('posts.index', compact('post'));
}
I am unsure about if my controller is acting in a strict MVC way, being that I thought it's only job is to direct traffic, but it's doing more by calling functions from my model. Is this the best way to go about this?