vendredi 17 juin 2016

Laravel 5.1 - get mount and day of date (with different variables)

i have my article resource controller, like this:

public function articles()
    {
        $articles = Article::OrderBy('id','DESC')->paginate(3);
        return view('blog', compact('articles'));
    }

I would like pass 2 variable to my view, like this:

$day = day of created article

$mount = mount of created article

return view('blog', compact('articles','day','mount'));

But i dont know how get this data from my DB, i can get date created like this:

$article->created_at

But how can i get only day and only mount and pass to my view?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire