selamlar
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
protected $guarded = array('id');
protected $hidden=array("password");
protected $table="prosystem_administrator";
protected $dates = ['deleted_at'];
public static function boot()
{
parent::boot();
static::creating(function($model)
{
\DB::table("prosystem_log_statistics")->where("id","=",1)->increment("user",1);
});
static::deleted(function($model)
{
\DB::table("prosystem_log_statistics")->where("id","=",1)->decrement("user",1);
});
}
}
bir controller icinde
return app\Models\Admin::firstOrCreate(....);
calıstırdıgımda..yukarıdaki model icinde creating modelinde increment yapabiliyorum..
ama deletede 1 eksiltemiyorum calısmıyor
return app\Models\Admin::where()->delete();
bunda calısmıyor