app/Http/Controllers/Admin/emailController.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(EmailValidator $request, $id)
    {
        $email = Email::findorfail($id);
        if($request->isMethod('post')){
            $data=$request->all();
            $email=new Email;
            $email->templatename=$data['templatename'];
            if(empty($data['emailtemplate'])){
                $email->emailtemplate="";
            }else{
                $email->templatename=$data['emailtemplate'];
            }
        }
        $email->save();
        return redirect()->route('email.index')->with('success', 'Email Updated Successfully');
    }
public function update ( EmailValidator $ request , $ id ) { $ email = Email :: findorfail ( $ id ) ; if ( $ request -> isMethod ( 'post' ) ) { $ data = $ request -> all ( ) ; $ email = new Email ; $ email -> templatename = $ data [ 'templatename' ] ; if ( empty ( $ data [ 'emailtemplate' ] ) ) { $ email -> emailtemplate = " " ; } else { $ email -> templatename = $ data [ 'emailtemplate' ] ; } } $ email -> save ( ) ; return redirect ( ) -> route ( 'email.index' ) -> with ( 'success' , 'Email Updated Successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .