mirror of
https://github.com/10h30/Test-Laravel-Eloquent-Basics.git
synced 2026-07-18 06:03:48 +09:00
Complete all stats
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\Stat;
|
||||
|
||||
class ProjectObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Project "created" event.
|
||||
*/
|
||||
public function creating(Project $project): void
|
||||
{
|
||||
|
||||
Stat::first()->increment('projects_count');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Project "updated" event.
|
||||
*/
|
||||
public function updated(Project $project): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Project "deleted" event.
|
||||
*/
|
||||
public function deleted(Project $project): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Project "restored" event.
|
||||
*/
|
||||
public function restored(Project $project): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Project "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Project $project): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user