public static function site_list() { if (GLobalHelp::person()->all_scope == false) { return Model\Site::whereHas('users_site_scope', function ($q) { $q->where('users_id', '=', GLobalHelp::person()->users_id); })->orderBy('name', 'asc')->groupBy('site.name', 'site.site_id')->get(); } else { return Model\Site::where('partner_id', '=', GLobalHelp::person()->partner_id)->orderBy('name', 'asc')->groupBy('site.name', 'site.site_id')->get(); } }
/** * Run the database seeds. * * @return void */ public function run() { Site::truncate(); factory(Site::class, 15)->create(); }