I have payment model and want to fire an custom event when payment confirmed.
My model code:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
protected $dates = [
'created_at', 'updated_at', 'confirmed_at',
];
public function confirmed(){
$this->setAttribute('confirmed_at', now());
$this->setAttribute('status', 'confirmed');
}
}