/**
  * Display merchant profile page.
  *
  * @return View
  */
 public function index()
 {
     $merchant_id = Auth::user()->id;
     $restaurant = $this->restaurant->getByAttributes(['merchant_id' => $merchant_id], false);
     $selected_cuisines = $this->restaurantCuisine->getByAttributesWithRelations(['restaurant_id' => $restaurant->id], ['cuisine'])->toArray();
     $cuisines_id = array_map(function ($structure) {
         return $structure['cuisine']['id'];
     }, $selected_cuisines);
     $data = array('merchant' => $this->merchant->getById($merchant_id), 'restaurant' => $restaurant, 'snapshot' => $this->snapshot->getByAttributes(['merchant_id' => $merchant_id]), 'outlet' => $this->outlet->getByAttributes(['merchant_id' => $merchant_id, 'main' => 1], false), 'outlets' => $this->outlet->getByAttributes(['merchant_id' => $merchant_id, 'main' => 0]), 'restaurant_cuisine' => $selected_cuisines, 'cuisines' => $this->cuisine->getAll(), 'cuisines_id' => $cuisines_id);
     return view('merchant.profile', $data);
 }
 /**
  * {@inheritDoc}
  */
 public function compareState(SnapshotInterface $snapshot)
 {
     $state = $snapshot->getState();
     if (!is_array($state)) {
         throw new \UnexpectedValueException(__CLASS__ . ' can only handle array-serialized state');
     }
     $objectState = (array) $snapshot->getObject();
     $snapshotState = $snapshot->getState();
     if ($objectState === $snapshotState) {
         return null;
     }
     return array_diff($objectState, $snapshotState);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function addSnapshot(SnapshotInterface $snapshot)
 {
     $this->snapshots[] = $snapshot;
     $snapshot->setPage($this);
 }