added affiliation tab card with its information
This commit is contained in:
1 parent
352d54a788
commit
c1fc28087e
14 files changed
+1493
-47
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class AffiliationMedia extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'club_affiliation_id',
|
||||
'media_type',
|
||||
'media_url',
|
||||
'title',
|
||||
'description',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the club affiliation that owns the media.
|
||||
*/
|
||||
public function clubAffiliation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ClubAffiliation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full URL for the media.
|
||||
*/
|
||||
public function getFullUrlAttribute(): string
|
||||
{
|
||||
if (filter_var($this->media_url, FILTER_VALIDATE_URL)) {
|
||||
return $this->media_url;
|
||||
}
|
||||
|
||||
return asset('storage/' . $this->media_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon class for media type.
|
||||
*/
|
||||
public function getIconClassAttribute(): string
|
||||
{
|
||||
return match($this->media_type) {
|
||||
'certificate' => 'bi-file-earmark-text',
|
||||
'photo' => 'bi-image',
|
||||
'video' => 'bi-play-circle',
|
||||
'document' => 'bi-file-text',
|
||||
default => 'bi-file',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user