FEATURE: move bussiness logic out of models
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Models\Widgets\ModelTraits;
|
||||
|
||||
use App\Models\Widgets\WidgetInWidgetArea as WidgetInWidgetAreaModel;
|
||||
|
||||
trait WidgetInWidgetArea
|
||||
{
|
||||
public static function getWidgetIdsFromArea($widgetAreaId)
|
||||
{
|
||||
$models = WidgetInWidgetAreaModel::where('widget_area_id', $widgetAreaId)
|
||||
->get();
|
||||
|
||||
$ids = [];
|
||||
foreach ($models as $model) {
|
||||
$ids[] = $model->widget_id;
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user