Example #1
0
 public function resolve($value)
 {
     $table = $this->router->resolved('table');
     $this->tables->setTable($table->table);
     $this->tables->setRecordClass(DatabaseRecord::class);
     if ($table->repository) {
         $this->tables->setRepository(context()->get(Repository::class . '.' . $table->repository));
     }
     $this->dynamic->joinTranslationsIfTranslatable($this->tables);
     $this->dynamic->joinPermissionsIfPermissionable($this->tables);
     return $this->tables->where('id', $value)->oneOrFail(function () {
         $this->response->unauthorized('Record not found');
     });
 }