Пример #1
0
 /**
  * Update the specified resource in storage.
  * @param type int $id
  * @param type Email $email
  * @param type EmailRequest $request
  * @return type Response
  */
 public function postemail($id, Email $email, EmailRequest $request)
 {
     try {
         /* fetch the values of email request  */
         $emails = $email->whereId('1')->first();
         /* fill the values to email table */
         $emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
         /* insert checkboxes  to database */
         $emails->email_fetching = $request->input('email_fetching');
         $emails->notification_cron = $request->input('notification_cron');
         $emails->all_emails = $request->input('all_emails');
         $emails->email_collaborator = $request->input('email_collaborator');
         $emails->strip = $request->input('strip');
         $emails->attachment = $request->input('attachment');
         /* Check whether function success or not */
         if ($emails->save() == true) {
             /* redirect to Index page with Success Message */
             return redirect('getemail')->with('success', 'Email Updated Successfully');
         } else {
             /* redirect to Index page with Fails Message */
             return redirect('getemail')->with('fails', 'Email can not Updated');
         }
     } catch (Exception $e) {
         /* redirect to Index page with Fails Message */
         return redirect('getemail')->with('fails', 'Email can not Updated');
     }
 }