<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SocialLink extends Model
{
protected $fillable = [
'platform', 'label', 'url', 'icon_svg', 'color',
'show_in_footer', 'show_in_fab', 'sort_order', 'is_active',
];
protected $casts = [
'show_in_footer' => 'boolean',
'show_in_fab' => 'boolean',
'is_active' => 'boolean',
'sort_order' => 'integer',
];
/** All active links ordered for display */
public function scopeActive($query)
{
return $query->where('is_active', true)->orderBy('sort_order')->orderBy('id');
}
/** Links shown in the footer social row */
public function scopeFooter($query)
{
return $query->active()->where('show_in_footer', true);
}
/** Links shown as floating action buttons */
public function scopeFab($query)
{
return $query->active()->where('show_in_fab', true);
}
}