/** * Return a device by its slug * @param $slug * @return Equipment */ public function findBySLug($slug) { $record = $this->model->where('slug', $slug)->first(); if ($record) { return $record; } throw new ModelNotFoundException(); }
public function canFetchPhoto(FunctionalTester $I) { $I->am('a developer'); $I->wantTo('ensure photos can be fetched'); $equipment = \BB\Entities\Equipment::findOrFail(2); $equipment->addPhoto('foo.png'); $equipment = \BB\Entities\Equipment::findOrFail(2); $I->assertEquals($equipment->getPhotoBasePath() . 'foo.png', $equipment->getPhotoPath(0)); }