اذهب إلى المحتوى

السؤال

Recommended Posts

  • 0
نشر

وعليكم السلام ورحمة الله وبركاته

الخطأ لديك أنك تستخدم ال routing name دون أن تقوم بتعريفه .

ستجد أنك تستخدم الدالة route('student-create') في ملف ال view  دون أن تقوم بتعريف إسما لل route student-create في ملف web.php .

لذلك يجب عليك إرسال ملف web.php وملف ال view الذى يحدث فيه المشكلة .

  • 0
نشر

ملف web.php  به تالي 

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\StudentController;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/student', [StudentController::class, 'index']);
Route::get('/student.edit', [StudentController::class, 'edit']);
 Route::get('/student.create', [StudentController::class, 'create']);

ملف create.blade.php

@extends('layouts.master');
@section('title')
الطلبة
@endsection
@section('title_page1')
قائمة الطلبة
@endsection
@section('title_page2')
 اضافة طالب
@endsection
@section('content')
 <form action="{{route('student.store')}}" method="POST">
    @csrf
    <div class="form-group">
        <label for="">اسم الطالب</label>
        <input type="text" name="name_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">رقم القيد</label>
        <input type="text" name="num_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">البريد الالكتروني</label>
        <input type="text" name="email_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">تاريخ ميلاد الطالب</label>
        <input type="text" name="date_student" class="form-control"class="">
    </div>
    <div class="form-group">
        <label for="">عنوان الطالب</label>
        <input type="text" name="adress_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">هاتف الطالب</label>
        <input type="text" name="phone" class="form-control"class="">
    </div>
    <div class="form-group">
        <button type="submit" class="btn btn-primary">حفظ</button>
    </div>
 </form>

@endsection
@section('scripts')
 
@endsection

 

  • 0
نشر
  بتاريخ On 3‏/7‏/2024 at 16:59 قال ايمن ميلاد:

ملف web.php  به تالي 

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\StudentController;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/student', [StudentController::class, 'index']);
Route::get('/student.edit', [StudentController::class, 'edit']);
 Route::get('/student.create', [StudentController::class, 'create']);
 

ملف create.blade.php

@extends('layouts.master');
@section('title')
الطلبة
@endsection
@section('title_page1')
قائمة الطلبة
@endsection
@section('title_page2')
 اضافة طالب
@endsection
@section('content')
 <form action="{{route('student.store')}}" method="POST">
    @csrf
    <div class="form-group">
        <label for="">اسم الطالب</label>
        <input type="text" name="name_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">رقم القيد</label>
        <input type="text" name="num_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">البريد الالكتروني</label>
        <input type="text" name="email_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">تاريخ ميلاد الطالب</label>
        <input type="text" name="date_student" class="form-control"class="">
    </div>
    <div class="form-group">
        <label for="">عنوان الطالب</label>
        <input type="text" name="adress_std" class="form-control">
    </div>
    <div class="form-group">
        <label for="">هاتف الطالب</label>
        <input type="text" name="phone" class="form-control"class="">
    </div>
    <div class="form-group">
        <button type="submit" class="btn btn-primary">حفظ</button>
    </div>
 </form>

@endsection
@section('scripts')
 
@endsection

 

 

أظهر المزيد  

الخطأ في ملف student.blade.php سطر 13 وليس create.blade.php .

 image.png.1f66c79f27fc08690a06cb66f74dd75e.png

عموما الحل هو تبديل أخر سطر لديك في ملف web.php بالتالي :

 Route::get('/student.create', [StudentController::class, 'create'])->name('student-create');

 

  • 0
نشر

هدا ملف ما الخطا به اخي محمد عاطف 

@extends('layouts.master');
@section('title')
 الطلبة
@endsection
@section('title_page1')
الطلبة
@endsection
@section('title_page2')
 قائمة الطلبة
@endsection
@section('content')
<div class="mb-5">
 <a href="{{route('student-create')}}" class="btn btn-sm btn-outline-primary">إضافة طالب</a>

</div>
    <table class="table">
        <thead>
            <tr>
                <th>اسم الطالب</th>
                <th>رقم القيد</th>
                <th>عنوان الطالب</th>
                <th>بريد الطالب</th>
                <th>رقم الهاتف</th>
                <th colspan="2"></th>
            </tr>
        </thead>
        <tbody>
            @if($students->count())
             @foreach ($students as $student) 
             <tr>
                <td>{{$student->name_std}}  </td>
                <td>{{$student->num_std}}</td>
                <td>{{$student->adress_std}}</td>
                <td>{{$student->email_std}}</td>
                <td>{{$student->phone}}</td>
                <td>
                    <a href="{{route('student.edit')}} " class="btn btn-sm btn-outline-success">تعديل</a>
                </td>
                <td>
                    <form action="{{route('student.destroy')}}" method="POST">
                      @csrf
                      <input type="hidden" name="_method" value="delete">
                      @method('delete')
                      <button type="submit" class="btn btn-sm btn-outline-danger">حذف</button>
                    </form>
                </td>
               
            </tr> 
             @endforeach 
            
                 
             @else
             <tr>
                <td colspan="5">لايوج بيانات لاعرضها</td>
             </tr>
                 
             @endif
            
          
        </tbody>
    </table>
@endsection
@section('scripts')
 
@endsection

 

  • 0
نشر
  بتاريخ On 3‏/7‏/2024 at 17:10 قال ايمن ميلاد:

هدا ملف ما الخطا به اخي محمد عاطف 

@extends('layouts.master');
@section('title')
 الطلبة
@endsection
@section('title_page1')
الطلبة
@endsection
@section('title_page2')
 قائمة الطلبة
@endsection
@section('content')
<div class="mb-5">
 <a href="{{route('student-create')}}" class="btn btn-sm btn-outline-primary">إضافة طالب</a>

</div>
    <table class="table">
        <thead>
            <tr>
                <th>اسم الطالب</th>
                <th>رقم القيد</th>
                <th>عنوان الطالب</th>
                <th>بريد الطالب</th>
                <th>رقم الهاتف</th>
                <th colspan="2"></th>
            </tr>
        </thead>
        <tbody>
            @if($students->count())
             @foreach ($students as $student) 
             <tr>
                <td>{{$student->name_std}}  </td>
                <td>{{$student->num_std}}</td>
                <td>{{$student->adress_std}}</td>
                <td>{{$student->email_std}}</td>
                <td>{{$student->phone}}</td>
                <td>
                    <a href="{{route('student.edit')}} " class="btn btn-sm btn-outline-success">تعديل</a>
                </td>
                <td>
                    <form action="{{route('student.destroy')}}" method="POST">
                      @csrf
                      <input type="hidden" name="_method" value="delete">
                      @method('delete')
                      <button type="submit" class="btn btn-sm btn-outline-danger">حذف</button>
                    </form>
                </td>
               
            </tr> 
             @endforeach 
            
                 
             @else
             <tr>
                <td colspan="5">لايوج بيانات لاعرضها</td>
             </tr>
                 
             @endif
            
          
        </tbody>
    </table>
@endsection
@section('scripts')
 
@endsection

 

 

أظهر المزيد  

كما أخبرتك منذ البداية أنك تستخدم الدالة route('student-create')  دون أن تعرف ال route في web.php 

وستجد هنا أنك تستخدمها وأعتقد أن هذا سطر 13 كما أخبرتك.

  بتاريخ On 3‏/7‏/2024 at 17:10 قال ايمن ميلاد:
 <a href="{{route('student-create')}}" class="btn btn-sm btn-outline-primary">إضافة طالب</a>
أظهر المزيد  

والحل هو وضع الإسم في ملف web.php كما أخبرتك هكذا 

 Route::get('/student.create', [StudentController::class, 'create'])->name('student-create');

وهذا سيحل المشكلة إن شاء الله حيث وضعنا إسم لل route وهو نفس الإسم الذى تستدعيه وهو student-create

  • 0
نشر
  بتاريخ On 3‏/7‏/2024 at 17:27 قال Mustafa Suleiman:

ليست نفس المشكلة، لديك حاليًا مسار student.edit غير معرف، عليك تعريفه بنفس الكيفية التي تم شرحها سابقًا في التعليقات

أظهر المزيد  

قمت بتعريفه لزالت نفس مشكلة 

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\StudentController;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/student', [StudentController::class, 'index']);
Route::get('/student.edit', [StudentController::class, 'edit'])->name('student-edit');
Route::get('/student.create', [StudentController::class, 'create'])->name('student-create');

 

  • 0
نشر
  بتاريخ On 3‏/7‏/2024 at 17:30 قال ايمن ميلاد:

قمت بتعريفه لزالت نفس مشكلة 

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\StudentController;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/student', [StudentController::class, 'index']);
Route::get('/student.edit', [StudentController::class, 'edit'])->name('student-edit');
Route::get('/student.create', [StudentController::class, 'create'])->name('student-create');

 

أظهر المزيد  

يعمل بشكل سليم، قم بحذف الكاش من خلال:

php artisan optimize:clear

 

  • 0
نشر
  بتاريخ On 3‏/7‏/2024 at 17:30 قال ايمن ميلاد:

قمت بتعريفه لزالت نفس مشكلة 

أظهر المزيد  

لاحظ أنك قمت بتسمية ال route إلى student-edit و تقوم بإستدعائه ب student.edit لذلك الحل هو كالتالي في ملف web.php

Route::get('/student.edit', [StudentController::class, 'edit'])->name('student.edit');

 

  • 0
نشر
  بتاريخ On 3‏/7‏/2024 at 18:41 قال محمد عاطف17:

لاجظ أنك قمت بتسمية ال route إلى student-edit و تقوم بإستدعائه ب student.edit لذلك الحل هو كالتالي في ملف web.php

Route::get('/student.edit', [StudentController::class, 'edit'])->name('student.edit');

 

أظهر المزيد  

الان يعمل بارك الله فيك اخي محمد عاطف ممكن تعمل لي كود ادخال بيانات لديك ملف مشروع مرفق في اعلي 

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...