Beispiel #1
0
 /**
  * show Business.
  *
  * @param Business            $business Business to show
  * @param BusinessFormRequest $request  Business form Request
  *
  * @return Response Rendered view for Business show
  */
 public function show(Business $business)
 {
     logger()->info(__METHOD__);
     logger()->info(sprintf('businessId:%s', $business->id));
     $this->authorize('manage', $business);
     // BEGIN
     session()->set('selected.business', $business);
     $notifications = Notifynder::entity(Business::class)->getNotRead($business->id, 20);
     Notifynder::entity(Business::class)->readAll($business->id);
     $this->time->timezone($business->timezone);
     // Build Dashboard Report
     $dashboard['appointments_active_today'] = $business->bookings()->active()->ofDate($this->time->today())->get()->count();
     $dashboard['appointments_canceled_today'] = $business->bookings()->canceled()->ofDate($this->time->today())->get()->count();
     $dashboard['appointments_active_tomorrow'] = $business->bookings()->active()->ofDate($this->time->tomorrow())->get()->count();
     $dashboard['appointments_active_total'] = $business->bookings()->active()->get()->count();
     $dashboard['appointments_served_total'] = $business->bookings()->served()->get()->count();
     $dashboard['appointments_total'] = $business->bookings()->get()->count();
     $dashboard['contacts_registered'] = $business->contacts()->count();
     $dashboard['contacts_subscribed'] = $business->contacts()->whereNotNull('user_id')->count();
     $time = $this->time->toTimeString();
     return view('manager.businesses.show', compact('business', 'notifications', 'dashboard', 'time'));
 }