FEATURE: move bussiness logic out of models
This commit is contained in:
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class WidgetInWidgetArea extends Model
|
||||
{
|
||||
use ModelTraits\WidgetInWidgetArea;
|
||||
|
||||
protected $table = 'widget_in_widget_area';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
@@ -16,18 +18,4 @@ class WidgetInWidgetArea extends Model
|
||||
'widget_area_id',
|
||||
'position'
|
||||
];
|
||||
protected $guarded = [];
|
||||
|
||||
public static function getWidgetIdsFromArea($widgetAreaId)
|
||||
{
|
||||
$models = WidgetInWidgetArea::where('widget_area_id', $widgetAreaId)
|
||||
->get();
|
||||
|
||||
$ids = [];
|
||||
foreach ($models as $model) {
|
||||
$ids[] = $model->widget_id;
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user