/** * Generates the group listing for the view. * * @param \Illuminate\Contracts\View\View $view * @return void */ public function compose(View $view) { $active_group = null; $active_project = null; if (isset($view->project) && !$view->project->is_template) { $active_group = $view->project->group_id; $active_project = $view->project->id; } $groups = Group::where('id', '<>', Template::GROUP_ID)->orderBy('name')->get(); $view->with('active_group', $active_group); $view->with('active_project', $active_project); $view->with('groups', $groups); }
/** * Run the migrations. */ public function up() { Schema::table('groups', function (Blueprint $table) { $table->unsignedInteger('order')->default(0); }); $groups = Group::where('id', '<>', Template::GROUP_ID)->orderBy('name')->get(); $i = 0; foreach ($groups as $group) { $group->order = $i; $group->save(); $i++; } }