Skip to content

Commit

Permalink
Order before and after hooks by order key ASC
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff.nielsen committed Apr 23, 2021
1 parent 19986b7 commit 17a2b41
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Models/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class Action extends Model
/**
* Fillable table column.
*
* @var array
* @var string[]
*/
public $fillable = [
protected $fillable = [
'name',
'order',
];
Expand Down Expand Up @@ -59,10 +59,14 @@ public function getHooksByProject($project)
{
return $this->with([
'beforeHooks' => function($query) use ($project) {
$query->where('project_id', $project->id);
$query
->where('project_id', $project->id)
->orderBy('order', 'asc');
},
'afterHooks' => function($query) use ($project) {
$query->where('project_id', $project->id);
$query
->where('project_id', $project->id)
->orderBy('order', 'asc');
}
]);
}
Expand Down

0 comments on commit 17a2b41

Please sign in to comment.