コード例 #1
0
ファイル: Profile.php プロジェクト: Smony/njphoto
 public function onRemoveSubscriber()
 {
     $email = post('email');
     $code = post('code');
     try {
         $subscriber = Subs::whereCode($code)->whereEmail($email)->whereStatus(1)->firstOrFail();
         $subscriber->status = 0;
         $subscriber->code = null;
         $subscriber->save();
         \Mail::send('jorgeandrade.subscribe::mail.unsubscribe', [], function ($message) use($email) {
             $message->to($email, 'Bye old Subscriber');
         });
         $this->page['result'] = $this->property('thanksMessage');
     } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         $this->page['result'] = "Email not found!";
     } catch (\Exception $e) {
         $this->page['result'] = $this->property('errorMessage');
     }
 }