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
+2 -14
View File
@@ -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;
}
}