forked from eatvio/eatvio-infra
analysators added
This commit is contained in:
@@ -4,18 +4,24 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Calendar;
|
||||
use App\Models\Diary;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\{Carbon, CarbonPeriod};
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
public $weekStartsAt;
|
||||
|
||||
public $weekEndsAt;
|
||||
|
||||
public $startsAt;
|
||||
|
||||
public $endsAt;
|
||||
|
||||
public $gridStartsAt;
|
||||
|
||||
public $gridEndsAt;
|
||||
|
||||
public function __construct($initialYear = null, $initialMonth = null, $weekStartsAt = null)
|
||||
@@ -23,8 +29,7 @@ class CalendarController extends Controller
|
||||
$this->weekStartsAt = $weekStartsAt ?? Carbon::MONDAY;
|
||||
$this->weekEndsAt = $this->weekStartsAt == Carbon::MONDAY
|
||||
? Carbon::SUNDAY
|
||||
: collect([0,1,2,3,4,5,6])->get($this->weekStartsAt + 6 - 7)
|
||||
;
|
||||
: collect([0, 1, 2, 3, 4, 5, 6])->get($this->weekStartsAt + 6 - 7);
|
||||
|
||||
$initialYear = $initialYear ?? Carbon::today()->year;
|
||||
$initialMonth = $initialMonth ?? Carbon::today()->month;
|
||||
@@ -40,6 +45,7 @@ class CalendarController extends Controller
|
||||
$this->gridStartsAt = $this->startsAt->clone()->startOfWeek($this->weekStartsAt);
|
||||
$this->gridEndsAt = $this->endsAt->clone()->endOfWeek($this->weekEndsAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
@@ -57,6 +63,7 @@ class CalendarController extends Controller
|
||||
->whereMonth('date', now()->month)
|
||||
->get()
|
||||
->keyBy('date');
|
||||
|
||||
return view(
|
||||
'calendar.index',
|
||||
[
|
||||
@@ -82,7 +89,6 @@ class CalendarController extends Controller
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
@@ -93,7 +99,6 @@ class CalendarController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Calendar $calendar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Calendar $calendar)
|
||||
@@ -104,7 +109,6 @@ class CalendarController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Calendar $calendar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Calendar $calendar)
|
||||
@@ -115,8 +119,6 @@ class CalendarController extends Controller
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Calendar $calendar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Calendar $calendar)
|
||||
@@ -127,7 +129,6 @@ class CalendarController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Calendar $calendar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Calendar $calendar)
|
||||
|
||||
Reference in New Issue
Block a user