Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Jun 30, 2023
1 parent 387c7c5 commit 73f96ea
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,14 @@ public function scopeAddPublishFields()
/**
* Determine if the user has the given abilities related to the entity.
*
* @param iterable|string|null $abilities
* @param iterable|string|null $abilities
* @param string $relation = null
* @return \Illuminate\Support\HigherOrderTapProxy<\Illuminate\Database\Eloquent\Model>
*/
public function authorize($abilities)
public function authorize($abilities, string $relation = null)
{
if (isset($abilities)) {
app(\Illuminate\Contracts\Auth\Access\Gate::class)->authorize($abilities, $this);
app(\Illuminate\Contracts\Auth\Access\Gate::class)->authorize($abilities, ($relation ? $this->$relation : $this));
}

return tap($this);
Expand Down Expand Up @@ -736,7 +737,7 @@ protected function getAttributeNamesFromModelLang(): array
*/
protected function mutateMerge(string $attribute, $value): array
{
$this->$attribute = array_merge((array) $this->$attribute, (array) $value);
$this->$attribute = array_merge((array) $this->$attribute, (array) $value);
return [$attribute => $this->getAttributes()[$attribute]];
}

Expand All @@ -749,7 +750,7 @@ protected function mutateMerge(string $attribute, $value): array
*/
protected function mutateDiff(string $attribute, $value): array
{
$this->$attribute = array_diff((array) $this->$attribute, (array) $value);
$this->$attribute = array_diff((array) $this->$attribute, (array) $value);
return [$attribute => $this->getAttributes()[$attribute]];
}

Expand Down

0 comments on commit 73f96ea

Please sign in to comment.