السلام عليكم لدي مشكلة اثناء زيارة صفحة تظهر فارغة
Route::get('Department', [DepartmentController::class, 'index'])->name('Department');
Route::get('Department/create', [DepartmentController::class, 'create']);
Route::get('Department/{id}', [DepartmentController::class, 'show']);
Route::post('Department', [DepartmentController::class, 'store']);
Route::get('Department/{id}/edit', [DepartmentController::class, 'edit']);
Route::put('Department/{id}',[DepartmentController::class, 'update']);
Route::delete('Department/{id}',[DepartmentController::class, 'destroy']);
كود صفحة index
@extends('layouts.master');
@section('title')
الاقسام
@stop
@section('css')
@stop
@section('title_page1')
لوحة التحكم
@stop
@section('title_page2')
الأقسام
@stop
@section('content')
<div class="box">
<div class="box-header">
<h4> <a href="/department/create">إضافة قسم</a></h4>
</div>
<!-- /.box-header -->
<div class="box-body no-padding">
<table class="table direction table-striped">
<th>#</th>
<th>اسم القسم</th>
<th>تاريخ الانشاء</th>
@foreach ($departments as $index => $department)
<tr>
<td>{{ $department->id_dept }}</td>
{{-- <td>{{ $department->Name_dept }}</td> --}}
<td><a href="/department/<?=$department->id_dept ?>"><?=$department->Name_dept ?></a></td>
<td>{{ $department->created_at }}</td>
</tr>
@endforeach
</table>
</div>
<!-- /.box-body -->
</div>
@endsection
@section('scripts')
@stop
دوال داخل controller
<?php
namespace App\Http\Controllers;
use App\Models\Department;
use Illuminate\Http\Request;
class DepartmentController extends Controller
{
public function index()
{
$departments = Department::all();
return view('department.index', compact('departments'));
}
public function show()
{
}
public function create()
{
return view ('department.create');
}
public function store()
{
}
public function edit($id)
{
return view ('department.edit');
}
public function update($id)
{
}
public function destroy($id)
{
}
}
صفحة create
@extends('layouts.master');
@section('title')
الاقسام
@stop
@section('css')
@stop
@section('title_page1')
الاقسام
@stop
@section('title_page2')
اضافة قسم
@stop
@section('content')
<form action="/Department" method="post">
<div class="form-group">
<label for="name">اسم القسم</label>
<input type="text" name="name" id="name" class="form-control">
</div>
<div class="form-group">
<button class="btn btn-primary">حفظ</button>
</div>
</form>
@stop
@section('scripts')
@stop
لماذا عندما ازور صفحة create يظهر 404