예제 #1
0
파일: Record.php 프로젝트: pckg/generic
 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');
     });
 }
예제 #2
0
파일: Table.php 프로젝트: pckg/generic
 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');
     });
 }