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
+10 -4
View File
@@ -3,22 +3,28 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
/**
* Class WidgetArea
*/
class WidgetArea extends Model
{
public $timestamps = true;
protected $fillable = [
'name',
'code',
'description'
];
protected $guarded = [];
public function getWidgets($uniqueCode)
{
return DB::table('widget_areas')
->select('widget_areas.*', 'widgets.widget_type_handler', 'widgets.name as widget_name', 'widgets.settings')
->where('code', $uniqueCode)
->join('widget_in_widget_area', 'widget_in_widget_area.widget_area_id', '=', 'widget_areas.id')
->join('widgets', 'widget_in_widget_area.widget_id', '=', 'widgets.id')
->orderBy('widget_in_widget_area.position');
}
}