Is possible to modify the default value response from Laravel Eloquent?
I have an API and my database has a migration payment
.
My payment has a column integer status
.
$table->integer('status')->default(1);
I want to know if is possible to change the default value with any function to change the Payment->get()
response.
For example:
public static $status = [
1 => "Waiting for payment",
2 => "In review",
3 => "Payed",
];
And automatically call my function:
class Payment extends Model
{
// ...
public getStatus() {
$this->status = $status[$this->status];
}
}