for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Arcanesoft\Blog\ViewComposers\Front\Widgets;
use Arcanesoft\Blog\Models\Post;
use Arcanesoft\Blog\ViewComposers\AbstractComposer;
use Illuminate\Contracts\View\View;
/**
* Class ArchivesWidgetComposer
*
* @package Arcanesoft\Blog\ViewComposers\Front\Widgets
* @author ARCANEDEV <[email protected]>
*/
class ArchivesWidgetComposer extends AbstractComposer
{
/* ------------------------------------------------------------------------------------------------
| Constants
| ------------------------------------------------------------------------------------------------
const VIEW = 'blog::front._composers.widgets.archives-widget';
| Main Functions
public function compose(View $view)
$archives = Post::published()
->get()
->groupBy(function (Post $post) {
return $post->publish_date->year;
});
$view->with('archivesWidgetItems', $archives);
}