Init
Este commit está contenido en:
32
app/Models/Playlist.php
Archivo normal
32
app/Models/Playlist.php
Archivo normal
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Playlist extends Model
|
||||
{
|
||||
public function tracks(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Track::class, 'playlist_track', 'PlaylistId', 'TrackId');
|
||||
}
|
||||
|
||||
protected $fillable = ['PlaylistId', 'Name'];
|
||||
|
||||
|
||||
protected $table = 'playlists'; //Si la tabla no es la esperada, definimos la variable $table con el nombre correspondiente.
|
||||
|
||||
protected $primaryKey = 'PlaylistId'; // Si la PK es distinta a id, definimos la variable $primaryKey con el nombre correcto.
|
||||
|
||||
public $incrementing = true; //true o false según si es o no autoincrementable la columna. Si se hace por trigger, definir
|
||||
// en false.
|
||||
|
||||
//protected $keyType = 'string'; Si el tipo no es entero, definimos la variable $keyType
|
||||
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Referencia en una nueva incidencia
Block a user
