Archived
feat: logging
This commit is contained in:
1 parent
b3784b77b1
commit
ceb4f36ba1
12 files changed
+169
-24
No files matched your search
+28
-2
@@ -14,11 +14,37 @@ class Quote extends Model
|
||||
|
||||
public function request(): void
|
||||
{
|
||||
// Send the notification
|
||||
// Send the quote
|
||||
// If success, add it to the transactions
|
||||
}
|
||||
|
||||
Log::create([
|
||||
'user_id' => auth()?->user()?->id,
|
||||
'quote_id' => $this->id,
|
||||
'content' => 'Quote requested.'
|
||||
]);
|
||||
}
|
||||
protected $fillable = [
|
||||
'quote',
|
||||
];
|
||||
|
||||
public static function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::created(function ($model) {
|
||||
Log::create([
|
||||
'user_id' => auth()?->user()?->id,
|
||||
'quote_id' => $model->id,
|
||||
'content' => 'Quote created.'
|
||||
]);
|
||||
});
|
||||
|
||||
self::deleted(function ($model) {
|
||||
Log::create([
|
||||
'user_id' => auth()?->user()?->id,
|
||||
'quote_id' => $model->id,
|
||||
'content' => 'Quote deleted.'
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user