app/Http/Controllers/EventController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {   
        $event = Event::find($id);
        if(!$event) {
            return redirect()->route('events.index')->withErrors('Вы не можете редактировать данный пост')
                ->withErrors('Ты куда-то не туда пошел');
        }
        $event->name_event = $request->name_event;
        $event->price = $request->price;
        $event->type_work = $request->type_work;
        $event->firm_id  = $request->firm_id ;
        $event->employee_id = $request->employee_id;
        $event->date = $request->date;
        $event->change_id  = $request->change_id;
        $event->update();
        return redirect()->route('events.index')->with('success', 'Пост успешно отредактирован');
    }
public function update ( Request $ request , $ id ) { $ event = Event :: find ( $ id ) ; if ( ! $ event ) { return redirect ( ) -> route ( 'events.index' ) -> withErrors ( 'Вы не можете редактировать данный пост') -> withErrors ( 'Ты куда-то не туда пошел'); } $ event -> name_event = $ request -> name_event ; $ event -> price = $ request -> price ; $ event -> type_work = $ request -> type_work ; $ event -> firm_id = $ request -> firm_id ; $ event -> employee_id = $ request -> employee_id ; $ event -> date = $ request -> date ; $ event -> change_id = $ request -> change_id ; $ event -> update ( ) ; return redirect ( ) -> route ( 'events.index' ) -> with ( 'success' , 'Пост успешно отредактирован'); }
Update the specified resource in storage.
Update the specified resource in storage .