Skip to content

Commit

Permalink
Use constructor property promotion for clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbestle committed Dec 22, 2024
1 parent 7d6756a commit b6e81f9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Cms/ModelPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
abstract class ModelPermissions
{
protected string $category;
protected ModelWithContent|Language $model;
protected array $options;
protected Permissions $permissions;
protected User $user;

public function __construct(ModelWithContent|Language $model)
public function __construct(protected ModelWithContent|Language $model)
{
$this->model = $model;
$this->user = $model->kirby()->user() ?? User::nobody();
$this->permissions = $this->user->role()->permissions();

Expand Down

0 comments on commit b6e81f9

Please sign in to comment.