/**
  * Get notFoundManyException.
  * @param $ids
  * @param Collection $models
  * @param string $keyName
  * @return ValidationExceptionCollection
  */
 protected function notFoundManyException($ids, $models, $keyName = '')
 {
     $errors = [];
     $models->keyBy($keyName);
     foreach ($ids as $id) {
         if ($models->get($id)) {
             $errors[] = null;
         } else {
             $errors[] = $this->notFoundException($keyName);
         }
     }
     throw new ValidationExceptionCollection($errors);
 }
Example #2
0
 public function prepareTickets(Collection $tickets)
 {
     return $tickets->keyBy('id')->map(function ($item, $key) {
         $item->status = $item->status;
         $item->priority = $item->priority;
         $item->category = $item->category;
         $item->customer = $item->customer;
         $item->agent = $item->agent;
         if ($item->agent) {
             $item->agent->department = $item->agent->department;
         }
         if ($item->customer) {
             $item->customer->company = $item->customer->company;
         }
         return $item;
     });
 }