27 lines
478 B
PHP
27 lines
478 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BeerList extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'user_id'
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function beer()
|
|
{
|
|
return $this->belongsToMany(Beer::class, 'beer_list_pivot', 'beer_id', 'list_id');
|
|
}
|
|
}
|