Пример #1
0
 public static function boot()
 {
     parent::boot();
     static::created(function ($notification) {
         switch ($notification->type) {
             case 'new_prospect':
                 $prospect = Prospect::find($notification->type_id);
                 $user = User::find($notification->user_id);
                 Clickatell::send("Nuevo Interesado en " . $prospect->type . " - Nombre: " . $prospect->name . " Email: " . $prospect->email . " Tel.: " . $prospect->phone, $user->phone);
                 $data = ['name' => $prospect->name, 'email' => $prospect->email, 'phone' => $prospect->phone];
                 Mail::queue('emails.notify.new-prospect', $data, function ($message) use($user) {
                     $message->from('*****@*****.**', 'MLMfunnel');
                     $message->to($user->email, $user->full_name)->subject('Nuevo prospecto! - MLMfunnel');
                 });
                 break;
         }
     });
 }
Пример #2
0
 public function update($id)
 {
     //should this be find or fail?
     $prospect = Prospect::find($id);
     if (Input::has('prospect-first-name')) {
         $prospect->prospect_first_name = Input::get('prospect-first-name');
     }
     if (Input::has('prospect-last-name')) {
         $prospect->prospect_last_name = Input::get('prospect-last-name');
     }
     if (Input::has('prospect-phone')) {
         $prospect->prospect_phone_number = Input::get('prospect-phone');
     }
     $prospect->prospect_email = Input::get('prospect-email');
     $prospect->prospect_house_bedrooms = Input::get('prospect-house-beds');
     $prospect->prospect_house_bathrooms = Input::get('prospect-house-baths');
     $prospect->prospect_house_sqft = Input::get('prospect-house-sqft');
     if ($prospect->save()) {
         return Redirect::action('HomeController@show', array('prospect' => $prospect->id));
     } else {
         Session::flash('errorMessage', 'An error has occurred!');
         return Redirect::back()->withInput();
     }
 }