Added the ability to add links to the project.

This commit is contained in:
2024-04-15 22:53:34 +05:00
parent 4583908230
commit 63ea5dac92
29 changed files with 756 additions and 13 deletions
+5
View File
@@ -52,4 +52,9 @@ final class Project extends Model implements StorageContract
{
return $this->hasMany(ProjectContent::class);
}
public function links(): HasMany
{
return $this->hasMany(ProjectLink::class);
}
}
@@ -0,0 +1,46 @@
<?php declare(strict_types=1);
namespace App\Models;
use App\Models\Scopes\SortScope;
use Illuminate\Database\Eloquent\Attributes\ScopedBy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
#[ScopedBy([SortScope::class])]
final class ProjectLink extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'project_links';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* The model's default values for attributes.
*
* @var array
*/
protected $attributes = [
'sort' => 100,
];
protected $fillable = [
'title',
'link',
'sort',
'language_id',
];
public function language(): BelongsTo
{
return $this->belongsTo(ProjectLanguage::class);
}
}