public function testThumbsDown() { $this->call('post', 'drivers/1/rating', array('type' => 'down')); $this->assertResponseOk(); $driver = DriverRepository::find(1); $this->assertEquals(1, $driver->thumbs_down); }
/** * Update the specified driver in storage. * * @param \Paxifi\Store\Repository\Driver\DriverRepository $driver * * @return \Illuminate\Http\JsonResponse */ public function update($driver = null) { try { \DB::beginTransaction(); if (is_null($driver)) { $driver = $this->getAuthenticatedDriver(); } with(new UpdateDriverValidator())->validate(\Input::except('email', 'seller_id', 'status', 'suspended')); $driver->update(\Input::except('email', 'seller_id', 'status', 'suspended')); \Event::fire('paxifi.store.updated', [$driver]); \DB::commit(); return $this->respondWithItem(DriverRepository::find($driver->id)); } catch (ValidationException $e) { return $this->errorWrongArgs($e->getErrors()); } catch (\Exception $e) { return $this->errorWrongArgs($e->getMessage()); } }
/** * 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); }