@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Calendar\Month;
|
||||
use App\Post;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class StatsController extends Controller
|
||||
{
|
||||
@@ -11,4 +13,22 @@ class StatsController extends Controller
|
||||
// TODO
|
||||
exit;
|
||||
}
|
||||
|
||||
public function calendar($type, $year = null, $month = null)
|
||||
{
|
||||
if (null === $month) {
|
||||
$month = date('m');
|
||||
}
|
||||
|
||||
if (null === $year) {
|
||||
$year = date('Y');
|
||||
}
|
||||
|
||||
$posts = Post::getUserPostForMonth(Auth::user()->getAuthIdentifier(), $year, $month);
|
||||
|
||||
if ('month' === $type) {
|
||||
$month_calendar = new Month($year, $month, $posts);
|
||||
return view('stats.calendar', ['month' => $month_calendar, 'type' => $type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ class GenerateMenus
|
||||
$stats->prepend('<i class="fe fe-trending-up"></i> ');
|
||||
$stats->checkActivationStatus();
|
||||
|
||||
$calendar = $menu->add('Mon calendrier', ['route' => ['calendar', 'month'], 'class' => 'nav-item'])->nickname('calendar');
|
||||
$calendar->link->attr(['class' => 'nav-link']);
|
||||
$calendar->prepend('<i class="fe fe-calendar"></i> ');
|
||||
$calendar->checkActivationStatus();
|
||||
|
||||
$gallery = $menu->add('Ma gallerie', ['route' => 'gallery', 'class' => 'nav-item'])->nickname('gallery');
|
||||
$gallery->link->attr(['class' => 'nav-link']);
|
||||
$gallery->prepend('<i class="fe fe-image"></i> ');
|
||||
|
||||
Reference in New Issue
Block a user