wip relation manager :(

This commit is contained in:
salam committed 2026-01-31 19:02:15 +01:00
1 parent ae5b566231
commit 94a3c6c472
24 files changed
+318 -217

No files matched your search

+10 -5
View File
@@ -28,10 +28,10 @@ class Event extends Model
'away_id',
];
// protected static function booted(): void
// {
// static::addGlobalScope(new SportScope);
// }
protected static function booted(): void
{
static::addGlobalScope(new SportScope);
}
public function provider()
{
@@ -53,6 +53,11 @@ class Event extends Model
return $this->belongsTo(Group::class);
}
public function user_notes()
{
return $this->hasMany(UserNote::class, 'event_id', 'id');
}
public function competition_group()
{
return $this->belongsTo(CompetitionGroup::class);
@@ -140,7 +145,7 @@ class Event extends Model
public function event_user_star()
{
return $this->hasOne(EventUserStar::class, 'event_id', 'id')->where('user_id', auth()->user()->id);
return $this->hasOne(EventUserStar::class, 'event_id', 'id');
}
public function event_bookmaker()
+6
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Scopes\UserScope;
use Illuminate\Database\Eloquent\Model;
class EventUserStar extends Model
@@ -10,4 +11,9 @@ class EventUserStar extends Model
'event_id',
'user_id',
];
protected static function booted(): void
{
static::addGlobalScope(new UserScope);
}
}
+13
View File
@@ -2,23 +2,36 @@
namespace App\Models;
use App\Models\Scopes\ClientScope;
use Illuminate\Database\Eloquent\Model;
class UserNote extends Model
{
protected $fillable = [
'user_messageid',
'event_id',
'bookmaker_id',
'user_id',
'client_id',
'message',
'deleted',
];
protected static function booted(): void
{
static::addGlobalScope(new ClientScope);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function client()
{
return $this->belongsTo(Client::class);
}
public function bookmaker()
{
return $this->belongsTo(Bookmaker::class);