count() > 0) { $first = Option::where('name', '=', 'payment_from')->first()->value; } else { $first = Date::now()->firstOfMonth()->format('Y-m-d'); } if (Option::where('name', '=', 'payment_end')->count() > 0) { $last = Option::where('name', '=', 'payment_end')->first()->value; } else { $last = Date::now()->format('Y-m-d'); } return view('payment.index', ['first' => $first, 'last' => $last]); } /** * Show the form for creating a new resource. */ public function create(): View { return view('payment.create'); } /** * Show the form for editing the specified resource. */ public function edit(Payment $payment): View { return view('payment.edit', ['payment' => $payment->load('invoice')]); } }