✅ OrganizationController (index, create, store, show, edit, update, destroy) ✅ OrganizationPolicy (viewAny, view, create, update, delete) ✅ Маршруты: /admin/organizations (resource) ✅ Blade-шаблоны: - admin/organizations/index.blade.php (список с пагинацией) - admin/organizations/create.blade.php (форма создания) - admin/organizations/show.blade.php (просмотр + статистика) - admin/organizations/edit.blade.php (форма редактирования) ✅ Обновлённое меню в dashboard/admin.blade.php Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
54 lines
1.1 KiB
PHP
Executable File
54 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Organization extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'inn',
|
|
'kpp',
|
|
'address',
|
|
'phone',
|
|
'email',
|
|
'description',
|
|
'is_active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function users(): HasMany
|
|
{
|
|
return $this->hasMany(User::class);
|
|
}
|
|
|
|
public function groups(): HasMany
|
|
{
|
|
return $this->hasMany(Group::class);
|
|
}
|
|
|
|
public function courseRequests(): HasMany
|
|
{
|
|
return $this->hasMany(CourseRequest::class);
|
|
}
|
|
|
|
public function courseAssignments(): HasMany
|
|
{
|
|
return $this->hasMany(CourseAssignment::class);
|
|
}
|
|
|
|
public function activeUsers(): HasMany
|
|
{
|
|
return $this->hasMany(User::class)->where('is_active', true);
|
|
}
|
|
}
|