journal-intime/app/Http/Controllers/StatsController.php

35 lines
763 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\Models\Calendar\Month;
use App\Post;
use Illuminate\Support\Facades\Auth;
class StatsController extends Controller
{
public function tag($tag = null)
{
// 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]);
}
}
}