app/Http/Controllers/SectionsController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\sections  $sections
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, sections $sections)
    {
        $id = $request->section_id;
        $this->validate( $request ,[
            'section_name'=>'required|max:255|unique:sections,section_name,'.$id,
            'section_description'=>'required',
            ],
            [
                'section_name.required'=>'اسم القسم مطلوب',
                'section_name.unique'=>'القسم موجود بالفعل',
                'section_description.required'=>'الوصف مطلوب',
            ]
        );
        $section = sections::find($id);
        $section->update([
            'section_name'=> $request->section_name,
            'description'=> $request->section_description,
        ]);
        session()->flash('edit', 'تم التعديل بنجاح');
        return redirect('/sections');
    }
public function update ( Request $ request , sections $ sections ) { $ id = $ request -> section_id ; $ this -> validate ( $ request , [ 'section_name' => 'required|max:255|unique:sections,section_name,' . $ id , 'section_description' => 'required' , ] , [ 'section_name.required' => 'اسم القسم مطلوب', 'section_name.unique' => 'القسم موجود بالفعل', 'section_description.required' => 'الوصف مطلوب', ] ) ; $ section = sections :: find ( $ id ) ; $ section -> update ( [ 'section_name' => $ request -> section_name , 'description' => $ request -> section_description , ] ) ; session ( ) -> flash ( 'edit' , 'تم التعديل بنجاح'); return redirect ( '/sections' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .