Начальный коммит: рабочая версия с исправленной авторизацией

This commit is contained in:
root
2026-01-11 19:15:02 +00:00
commit 2d98209ce1
206 changed files with 20957 additions and 0 deletions

55
app/Models/PCBuild.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PcBuild extends Model
{
use HasFactory;
protected $fillable = [
'name',
'description',
'user_id',
];
<<<<<<< HEAD
// 👇 Связь "многие-ко-многим" с компонентами
public function components()
{
return $this->belongsToMany(Component::class, 'pc_build_components');
}
// Обратная связь
=======
protected $casts = [
'is_ai_generated' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
// Связь с пользователем
>>>>>>> origin/main
public function user()
{
return $this->belongsTo(User::class);
}
<<<<<<< HEAD
// Опционально: защита от ошибок, если сборка без пользователя
protected static function booted()
{
static::addGlobalScope('user', function ($query) {
if (auth()->check()) {
$query->where('user_id', auth()->id());
}
});
}
=======
>>>>>>> origin/main
}