Ajoute la vue calendrier

Pour #3
This commit is contained in:
2020-03-18 16:57:32 +01:00
parent 2ad19f4793
commit 9a6d257de0
9 changed files with 393 additions and 1 deletions

View File

@@ -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]);
}
}
}