-
app/Models/Tip.php
Open in GitHubuse App\Types\Model; use App\Concerns\Tip\Relationships; class Tip extends Model { use Relationships; // }
-
app/Concerns/Tip/Relationships.php
Open in GitHubuse App\Models\Like; use App\Models\User; use App\Models\Banner; use App\Models\Comment; use App\Models\Bookmark; use App\Models\Notification; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; trait Relationships { public function banner() : BelongsTo { return $this->belongsTo(Banner::class); } public function bookmarks() : HasMany { return $this->hasMany(Bookmark::class); } public function comments() : HasMany { return $this->hasMany(Comment::class); } public function likes() : HasMany { return $this->hasMany(Like::class); } public function notifications() : HasMany { return $this->hasMany(Notification::class); } public function user() : BelongsTo { return $this->belongsTo(User::class); } }