We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| @@ 437-445 (lines=9) @@ | ||
| 434 | * |
|
| 435 | * @param [string] Full model namespace. Ex: App\Models\Article |
|
| 436 | */ |
|
| 437 | public function setModel($model_namespace) |
|
| 438 | { |
|
| 439 | if (!class_exists($model_namespace)) throw new \Exception('This model does not exist.', 404); |
|
| 440 | ||
| 441 | $this->model = new $model_namespace(); |
|
| 442 | $this->query = $this->model->select('*'); |
|
| 443 | ||
| 444 | // $this->setFromDb(); // i think that, by default, the auto-fields functionality should be disabled; otherwise, the workflow changes from "set the fields i need" to "update this crud with whatever i need"; which i personally don't like, because it's more hacky and it assumes you should see what the default offers you, then adapt; I propose we set wether the auto-fields functionality is run for panels with a config variable; the config file should be backpack/crud.php and the variable name should be "autoSetFromDb". |
|
| 445 | } |
|
| 446 | ||
| 447 | /** |
|
| 448 | * Get the corresponding Eloquent Model for the CrudController, as defined with the setModel() function; |
|
| @@ 41-49 (lines=9) @@ | ||
| 38 | $this->initState(); |
|
| 39 | } |
|
| 40 | ||
| 41 | public function setModel($model) |
|
| 42 | { |
|
| 43 | if (!class_exists($model)) throw new \Exception('This model does not exist.', 404); |
|
| 44 | ||
| 45 | $this->model = new $model(); |
|
| 46 | $this->query = $this->model->select('*'); |
|
| 47 | ||
| 48 | $this->initEntities(); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function getModel() |
|
| 52 | { |
|