/** * Insert statuses. */ public function insertStatuses() { $statuses = [['name' => "New", 'status' => 1, 'show_on_changelog' => false], ['name' => "Accepted", 'status' => 1, 'show_on_changelog' => false], ['name' => "Started", 'status' => 2, 'show_on_changelog' => false], ['name' => "Closed", 'status' => 0, 'show_on_changelog' => true], ['name' => "Completed", 'status' => 0, 'show_on_changelog' => true]]; foreach ($statuses as $status) { $model = new Status($status); $model->save(); } }
function createStatus() { $status = new Status(['name' => 'status-' . mkRandomHash(5) . '-name']); $status->save(); return $status; }