コード例 #1
0
 public function testThumbsDown()
 {
     $this->call('post', 'drivers/1/rating', array('type' => 'down'));
     $this->assertResponseOk();
     $driver = DriverRepository::find(1);
     $this->assertEquals(1, $driver->thumbs_down);
 }
コード例 #2
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();
     }
 }
コード例 #3
0
 /**
  * register commission rate.
  */
 public function registerCommissionRate()
 {
     $driverId = $this->resourceServer->getOwnerId();
     $commissionRate = !!$driverId && ($driver = DriverRepository::find($driverId)) ? $driver->getCommissionRate() : 0;
     $this->app['config']->set('paxifi.commission.rate', $commissionRate);
 }