public function toggleReceipt(Occurrence $occurrence, Request $request) { $this->validate($request, ['state' => 'required|boolean']); $occurrence->receipt_sent = $request->get('state'); $occurrence->save(); return $occurrence->receipt_sent; }
/** * Creates a new occurrence that occurs at given date * and associates it with given service. * * @param Carbon $date * @param Service $service * @return Occurrence */ public function create(Carbon $date, Service $service) { $occurrence = new Occurrence(); $occurrence->occurs_at = $date->timestamp; $occurrence->offer_sent = false; $occurrence->payment_received = false; $occurrence->receipt_sent = false; $occurrence->service()->associate($service); $occurrence->save(); return $occurrence; }