public function createLog()
{
$actions = [];
foreach (trans('globals.action_types') as $value) {
if ($value['source_type'] == 'order') {
$actions[$value['action']] = $value['id'];
}
}
if (isset($actions[$this->status])) {
Log::create(['action_type_id' => $actions[$this->status], 'source_id' => $this->id, 'user_id' => $this->user_id, 'details' => "Order #{$this->id} {$this->status}"]);
}
return $this;
}