Hayitham Fathy نشر 19 أغسطس 2022 أرسل تقرير مشاركة نشر 19 أغسطس 2022 (معدل) السلام عليكم اعتذر علي الاسئله الكثير اريد حل للمشكلة <!-- edit --> <div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">تعديل التصنيف</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form action="Classification/update" method="post" autocomplete="off"> {{ method_field('patch') }} {{ csrf_field() }} <div class="form-group"> <input type="hidden" name="id" id="id" value=""> <label for="recipient-name" class="col-form-label">اسم التصنيف:</label> <input class="form-control" name="classification" id="classification" type="text"> </div> <div class="form-group"> <label for="message-text" class="col-form-label">الوصف:</label> <textarea class="form-control" id="description" name="description"></textarea> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">تاكيد</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">اغلاق</button> </div> </form> </div> </div> </div> تم التعديل في 19 أغسطس 2022 بواسطة Hassan Hedr توضيح العنوان 1 اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
0 Hassan Hedr نشر 19 أغسطس 2022 أرسل تقرير مشاركة نشر 19 أغسطس 2022 تأكد من السماح للطريقة PATCH ضمن ملف التوجيه web.php الخاص بك على المسار Classification/update كالتالي: Route::patch('Classification/update', '...'); ^^^^^ سبب المشكلة هو عدم تعريف هذه الطريقة لذلك المسار فلا يمكنك إرسال طلب النموذج إليه 1 اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
0 Hayitham Fathy نشر 19 أغسطس 2022 الكاتب أرسل تقرير مشاركة نشر 19 أغسطس 2022 بتاريخ 2 ساعات قال Hassan Hedr: تأكد من السماح للطريقة PATCH ضمن ملف التوجيه web.php الخاص بك على المسار Classification/update كالتالي: Route::patch('Classification/update', '...'); ^^^^^ سبب المشكلة هو عدم تعريف هذه الطريقة لذلك المسار فلا يمكنك إرسال طلب النموذج إليه شكرا لاهتمامك ولاكن انا عامل الكود ده Route::resource('classification', 'App\Http\Controllers\ClassificationController'); اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
0 Hassan Hedr نشر 19 أغسطس 2022 أرسل تقرير مشاركة نشر 19 أغسطس 2022 بتاريخ 2 ساعات قال Hayitham Fathy: شكرا لاهتمامك ولاكن انا عامل الكود ده Route::resource('classification', 'App\Http\Controllers\ClassificationController'); تأكد إذًا من وجود الدالة update ضمن المتحكم ClassificationController كالتالي: class ClassificationController extends Controller { .. public function update($id) { .. } } 1 اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
0 Hayitham Fathy نشر 19 أغسطس 2022 الكاتب أرسل تقرير مشاركة نشر 19 أغسطس 2022 (معدل) بتاريخ منذ ساعة مضت قال Hassan Hedr: تأكد إذًا من وجود الدالة update ضمن المتحكم ClassificationController كالتالي: class ClassificationController extends Controller { .. public function update($id) { .. } } ده كود البليد والكنترول @section('content') @if ($errors->any()) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif @if (session()->has('edit')) <div class="alert alert-success alert-dismissible fade show" role="alert"> <strong>{{ session()->get('edit') }}</strong> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> @endif @if (session()->has('Add')) <div class="alert alert-success alert-dismissible fade show" role="alert"> <strong>{{ session()->get('Add') }}</strong> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> @endif @if (session()->has('Error')) <div class="alert alert-danger alert-dismissible fade show" role="alert"> <strong>{{ session()->get('Error') }}</strong> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> @endif <!-- row --> <div class="row"> <div class="col-xl-12"> <div class="card"> <div class="card-header pb-0"> {{-- <div class="d-flex justify-content-between"> <h4 class="card-title mg-b-0">SIMPLE TABLE</h4> <i class="mdi mdi-dots-horizontal text-gray"></i> </div> --}} <div class="col-sm-6 col-md-4 col-xl-3"> <a class="modal-effect btn btn-outline-primary btn-block" data-effect="effect-scale" data-toggle="modal" href="#modaldemo8">اضافة تصنيف</a> </div> </div> <div class="card-body"> <div class="table-responsive"> <table class="table text-md-nowrap" id="example1"> <thead> <tr> <th class="wd-15p border-bottom-0">#</th> <th class="wd-15p border-bottom-0">اسم التصنيف</th> <th class="wd-20p border-bottom-0">الوصف</th> <th class="wd-15p border-bottom-0">العمليات</th> </tr> </thead> <tbody> <?php $i =0 ?> @foreach ( $classification as $x) <?php $i++?> <tr> <td>{{$i}}</td> <td>{{$x->classification}}</td> <td>{{$x->description}}</td> <td> {{-- @can('تعديل قسم') --}} <a class="modal-effect btn btn-sm btn-info" data-effect="effect-scale" data-id="{{ $x->id }}" data-classification="{{ $x->classification }}" data-description="{{ $x->description }}" data-toggle="modal" href="#exampleModal2" title="تعديل"><i class="las la-pen"></i></a> {{-- @endcan --}} {{-- @can('حذف قسم') --}} <a class="modal-effect btn btn-sm btn-danger" data-effect="effect-scale" data-id="{{ $x->id }}" data-classification="{{ $x->classification }}" data-toggle="modal" href="#modaldemo9" title="حذف"><i class="las la-trash"></i></a> {{-- @endcan --}} </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> <!--/div--> </div> </div> <div class="modal" id="modaldemo8"> <div class="modal-dialog" role="document"> <div class="modal-content modal-content-demo"> <div class="modal-header"> <h6 class="modal-title">اضافة تصنيف</h6><button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">×</span></button> </div> <div class="modal-body"> <form action="{{ route('classification.store') }}" method="post"> {{ csrf_field() }} <div class="form-group"> <label for="exampleInputEmail1">اسم التصنيف</label> <input type="text" class="form-control" id="classification" name="classification"> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">الوصف</label> <textarea class="form-control" id="description" name="description" rows="3"></textarea> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success">تاكيد</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">اغلاق</button> </div> </div> </div> </div> <!-- edit --> <div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">تعديل التصنيف</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form action="Classification/update" method="post" autocomplete="off"> {{ method_field('patch') }} {{ csrf_field() }} <div class="form-group"> <input type="hidden" name="id" id="id" value=""> <label for="recipient-name" class="col-form-label">اسم التصنيف:</label> <input class="form-control" name="classification" id="classification" type="text"> </div> <div class="form-group"> <label for="message-text" class="col-form-label">الوصف:</label> <textarea class="form-control" id="description" name="description"></textarea> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">تاكيد</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">اغلاق</button> </div> </form> </div> </div> </div> <!-- delete --> <div class="modal" id="modaldemo9"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content modal-content-demo"> <div class="modal-header"> <h6 class="modal-title">حذف التصنيف</h6><button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">×</span></button> </div> <form action="sections/destroy" method="post"> {{ method_field('delete') }} {{ csrf_field() }} <div class="modal-body"> <p>هل انت متاكد من عملية الحذف ؟</p><br> <input type="hidden" name="id" id="id" value=""> <input class="form-control" name="classification" id="classification" type="text" readonly> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">الغاء</button> <button type="submit" class="btn btn-danger">تاكيد</button> </div> </div> </form> </div> </div> </div> <!-- row closed --> </div> <!-- Container closed --> </div> <!-- main-content closed --> @endsection @section('js') <script src="{{ URL::asset('assets/plugins/datatable/js/jquery.dataTables.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/dataTables.dataTables.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/dataTables.responsive.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/responsive.dataTables.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/jquery.dataTables.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/dataTables.bootstrap4.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/dataTables.buttons.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/buttons.bootstrap4.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/jszip.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/pdfmake.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/vfs_fonts.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/buttons.html5.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/buttons.print.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/buttons.colVis.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/dataTables.responsive.min.js') }}"></script> <script src="{{ URL::asset('assets/plugins/datatable/js/responsive.bootstrap4.min.js') }}"></script> <!--Internal Datatable js --> <script src="{{ URL::asset('assets/js/table-data.js') }}"></script> <script src="{{ URL::asset('assets/js/modal.js') }}"></script> <script> $('#exampleModal2').on('show.bs.modal', function(event) { var button = $(event.relatedTarget) var id = button.data('id') var classification = button.data('classification') var description = button.data('description') var modal = $(this) modal.find('.modal-body #id').val(id); modal.find('.modal-body #classification').val(classification); modal.find('.modal-body #description').val(description); }) </script> <script> $('#modaldemo9').on('show.bs.modal', function(event) { var button = $(event.relatedTarget) var id = button.data('id') var classification = button.data('classification') var modal = $(this) modal.find('.modal-body #id').val(id); modal.find('.modal-body #classification').val(classification); }) </script> @endsection ------------------------------------------------------------------------------------------ <?php namespace App\Http\Controllers; use App\Models\Classification; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Validation\Rules\Exists; class ClassificationController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $classification =Classification::all(); return view('order detail.classification',compact('classification')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $validatedData = $request->validate([ 'classification' => 'required|unique:classifications|max:50', ],[ 'classification.required' =>'يرجي ادخال اسم التصنيف', 'classification.unique' =>'التصنيف مسجل مسبقا', ]); Classification::create([ 'classification'=> $request->classification, 'description' =>$request-> description, 'created_by'=> (Auth::user()->name), ]); session()->flash('Add', 'تم الاضافة بنجاح '); return redirect('/classification'); } /** * Display the specified resource. * * @param \App\Models\Classification $classification * @return \Illuminate\Http\Response */ public function show(Classification $classification) { // } /** * Show the form for editing the specified resource. * * @param \App\Models\Classification $classification * @return \Illuminate\Http\Response */ public function edit(Classification $classification) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\Classification $classification * @return \Illuminate\Http\Response */ public function update(Request $request) { echo"232313133"; // $id = $request->id; // $this->validate($request, [ // 'classification' => 'required|max:50|unique:sections,classification,'.$id, // 'description' => 'required', // ],[ // 'classification.required' =>'يرجي ادخال اسم التصنيف', // 'classification.unique' =>'اسم التصنيف مسجل مسبقا', // 'description.required' =>'يرجي ادخال البيان', // ]); // $classification = classification::find($id); // $classification->update([ // 'classification' => $request->classification, // 'description' => $request->description, // ]); // session()->flash('edit','تم تعديل التصنيف بنجاج'); // return redirect('/classifications'); } /** * Remove the specified resource from storage. * * @param \App\Models\Classification $classification * @return \Illuminate\Http\Response */ public function destroy(Classification $classification) { // $id = $request->id; // classification::find($id)->delete(); // session()->flash('delete','تم حذف القسم بنجاح'); // return redirect('/classifications'); } } تم التعديل في 19 أغسطس 2022 بواسطة Hayitham Fathy اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
السؤال
Hayitham Fathy
السلام عليكم اعتذر علي الاسئله الكثير اريد حل للمشكلة
توضيح العنوان
رابط هذا التعليق
شارك على الشبكات الإجتماعية
4 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.