public function testThumbsDown() { $this->call('post', 'drivers/1/rating', array('type' => 'down')); $this->assertResponseOk(); $driver = DriverRepository::find(1); $this->assertEquals(1, $driver->thumbs_down); }
/** * 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(); } }
/** * 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); }