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');
     });
 }
Example #2
0
 public function resolve($value)
 {
     $this->dynamic->joinTranslationsIfTranslatable($this->tables);
     $this->dynamic->joinPermissionsIfPermissionable($this->tables);
     return $this->tables->where('id', $value)->withFields(function (HasMany $fields) {
         $fields->joinTranslation();
         $fields->joinFallbackTranslation();
         $fields->withFieldType();
         $fields->withSettings();
     })->withTabs(function (HasMany $tabs) {
         $tabs->joinTranslation();
         $tabs->joinFallbackTranslation();
     })->oneOrFail(function () {
         $this->response->unauthorized('Table not found');
     });
 }