35 lines
		
	
	
		
			763 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			763 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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]);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |