Ale Gallo
b91cf0cbde
committing part of the laravel system with templating files and api implementation.
34 lines
829 B
PHP
34 lines
829 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Route extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = ['name_it', 'name_en', 'description_it', 'description_en', 'route_category_id'];
|
|
|
|
public function routeSportDetails()
|
|
{
|
|
return $this->hasMany(RouteSportDetails::class, 'route_id');
|
|
}
|
|
|
|
public function pictures()
|
|
{
|
|
return $this->belongsToMany(Picture::class, 'route_picture', 'route_id', 'picture_id');
|
|
}
|
|
|
|
public function category()
|
|
{
|
|
return $this->belongsTo(Category::class, 'route_category_id');
|
|
}
|
|
|
|
public function sport()
|
|
{
|
|
return $this->belongsTo(Sports::class, 'sport_id');
|
|
}
|
|
}
|