model = $example; $example->workflow()->apply($example, $transition); $transition = Str::camel($transition); return $this->$transition($example); } public function submit() { $this->model->status = 'Pending'; $this->model->save(); return $this->model; } public function approve() { $this->model->status = 'Approved'; $this->model->save(); return $this->model; } public function reject() { $this->model->status = 'Draft'; $this->model->save(); return $this->model; } public function publish() { $this->model->status = 'Published'; $this->model->save(); return $this->model; } public function unpublish() { $this->model->status = 'Unpublished'; $this->model->save(); return $this->model; } public function archive() { $this->model->status = 'Archived'; $this->model->save(); return $this->model; } public function unarchive() { $this->model->status = 'Draft'; $this->model->save(); return $this->model; } }