weizong song 5 years ago
parent 71818c2548
commit 06c8d1de44

@ -18,7 +18,8 @@ class Paramedic extends SoftDeletesModel
static::addGlobalScope(new AdminProjectScope());
}
public function getStatusNameAttribute() {
public function getStatusNameAttribute()
{
$status_name = $this->status;
switch ($this->status) {
case self::STATUS_ACTIVE:
@ -31,6 +32,23 @@ class Paramedic extends SoftDeletesModel
return $status_name;
}
public function toggle()
{
switch ($this->status) {
case self::STATUS_ACTIVE:
$this->update([
"status" => self::STATUS_INACTIVE
]);
break;
case self::STATUS_INACTIVE:
$this->update([
"status" => self::STATUS_ACTIVE
]);
break;
}
return $this;
}
public function getAvatarUrlAttribute()
{
$protocol = request()->secure() ? "https" : "http";

Loading…
Cancel
Save