FEATURE #1450: add widget overview

This commit is contained in:
Michal Kváček
2016-02-15 12:25:56 +01:00
parent ccc2d918c9
commit 1d553d1a15
6 changed files with 170 additions and 8 deletions
+13 -4
View File
@@ -9,16 +9,25 @@ use Illuminate\Database\Eloquent\Model;
*/
class WidgetInWidgetArea extends Model
{
protected $table = 'widget_in_widget_area';
public $timestamps = false;
protected $fillable = [
'widget_id',
'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;
}
}