Начальный коммит: рабочая версия с исправленной авторизацией
This commit is contained in:
35
app/Models/PCBuildComponent.php
Normal file
35
app/Models/PCBuildComponent.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PcBuildComponent extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'pc_build_id',
|
||||
'component_id',
|
||||
'quantity',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'quantity' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
// Связь с сборкой
|
||||
public function build()
|
||||
{
|
||||
return $this->belongsTo(PcBuild::class);
|
||||
}
|
||||
|
||||
// Связь с компонентом
|
||||
public function component()
|
||||
{
|
||||
return $this->belongsTo(Component::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user