Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Tag;
|
||||
use App\Traits\TaggableWithLocale;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class TaggableLocale extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use TaggableWithLocale;
|
||||
|
||||
protected $table = 'taggable_locales';
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
// updating created_by and updated_by when model is created
|
||||
static::creating(function ($model) {
|
||||
if (!$model->isDirty('updated_by_user')) {
|
||||
$model->updated_by_user = Auth::guard('web')->user()->id;
|
||||
}
|
||||
});
|
||||
|
||||
// updating updated_by when model is updated
|
||||
static::updating(function ($model) {
|
||||
if (!$model->isDirty('updated_by_user')) {
|
||||
$model->updated_by_user = Auth::guard('web')->user()->id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function tag()
|
||||
{
|
||||
return $this->belongsTo(Tag::class, 'taggable_tag_id', 'tag_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user