✅ 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>
47 lines
1020 B
PHP
Executable File
47 lines
1020 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class CourseRequest extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'organization_id',
|
|
'requested_by_user_id',
|
|
'approved_by_user_id',
|
|
'status',
|
|
'comment',
|
|
'approved_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'approved_at' => 'datetime',
|
|
];
|
|
|
|
public function organization(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Organization::class);
|
|
}
|
|
|
|
public function requestedBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'requested_by_user_id');
|
|
}
|
|
|
|
public function approvedBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'approved_by_user_id');
|
|
}
|
|
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(CourseRequestItem::class);
|
|
}
|
|
}
|