コード例 #1
0
 /**
  * Upload a single file.
  *
  * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file
  *
  * @param string $target
  * @return string
  */
 protected function uploadSingleFile($file, $target = null)
 {
     $filename = uniqid() . '.' . $file->getClientOriginalExtension();
     $filename = $target ? $target . '/' . $filename : $filename;
     $content = file_get_contents($file->getRealPath());
     $this->flysystem->write($filename, $content);
     return cloudfront_asset($filename);
 }
コード例 #2
0
 public function transform(DriverRepositoryInterface $driver)
 {
     $transformer = array('id' => $driver->id, 'email' => $driver->email, 'photo' => !empty($driver->photo) ? $driver->photo : cloudfront_asset('photos/default-logo.png'), 'name' => $driver->name, 'seller_id' => !empty($driver->seller_id) ? $driver->seller_id : "", 'address' => $driver->address, 'currency' => $driver->currency, 'tax' => $this->transformTaxConfiguration($driver), 'settings' => array('notify_sale' => (bool) $driver->notify_sale, 'notify_inventory' => (bool) $driver->notify_inventory, 'notify_feedback' => (bool) $driver->notify_feedback, 'notify_billing' => (bool) $driver->notify_billing, 'notify_others' => (bool) $driver->notify_others), 'thumbs_up' => $driver->thumbs_up, 'thumbs_down' => $driver->thumbs_down, 'suspended' => $driver->suspended, 'status' => $driver->status, 'created_at' => $driver->created_at, 'comments_count' => $driver->comments()->get()->count());
     return $transformer;
 }
コード例 #3
0
ファイル: DriverController.php プロジェクト: xintang22/Paxifi
 /**
  * Search store by different criteria.
  *
  * @TODO: add more searchable fields
  */
 public function search()
 {
     try {
         $q = \Input::get('q');
         /** @var \Illuminate\Support\Collection $searchParams */
         $searchParams = $this->extractSearchParams(explode(',', $q));
         if ($searchParams->isEmpty()) {
             return $this->errorWrongArgs('Missing or invalid search arguments.');
         }
         $result = DriverRepository::search($searchParams)->first();
         if (empty($result->photo)) {
             $result->photo = cloudfront_asset('images/drivers/template/driver_logo.png');
         }
         return $this->respondWithItem($result);
     } catch (ModelNotFoundException $e) {
         return $this->setStatusCode(404)->respondWithError('Store Not Found');
     } catch (\Exception $e) {
         return $this->errorInternalError();
     }
 }
コード例 #4
0
 /**
  * @return string
  */
 public function getDriverLogoCircleCoverUrl()
 {
     return cloudfront_asset($this->driverLogoCircleCover);
 }
コード例 #5
0
ファイル: StickerFactory.php プロジェクト: xintang22/Paxifi
 /**
  * Get all the file path and url path for sticker image and sticker pdf.
  *
  * @return array
  */
 public function getStickerFilesPath()
 {
     return ["image" => cloudfront_asset($this->getStickerFileUrl()), "pdf" => cloudfront_asset($this->getStickerPdfUrl())];
 }