FEATURE: move bussiness logic out of models

This commit is contained in:
Michal Kváček
2016-10-17 01:05:20 +02:00
parent 2ded2924a1
commit e26e6fd460
46 changed files with 1069 additions and 1039 deletions
@@ -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;
}
}