Пример #1
0
 /** @test */
 public function it_throws_an_exception_when_model_not_found()
 {
     $title = new Title();
     $this->setExpectedException('\\Exception');
     $title->from(TitleTestModel::class, 'title');
     $title->get(10);
 }
Пример #2
0
 /**
  * Run filter
  * @param Builder $query
  * @param array $parameters
  * @return string
  */
 public function filter(Builder $query, $parameters)
 {
     $parameter = $this->getParameter($parameters);
     if (is_null($parameter)) {
         return null;
     }
     if (!$this->applyScope($query, $parameter) && $this->name) {
         $query->where($this->name, '=', $parameter);
     }
     return $this->title->get($parameter);
 }