first commit

This commit is contained in:
Doar Mihai
2026-04-28 16:10:27 +03:00
commit b73f568d90
107 changed files with 18067 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Trip extends Model
{
protected $fillable = [
'user_id',
'name',
'description',
];
/**
* Get the user that owns this trip
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Get all cities in this trip
*/
public function cities(): BelongsToMany
{
return $this->belongsToMany(City::class, 'city_trip')
->withPivot('order')
->withTimestamps()
->orderByPivot('order');
}
}