Example #1
0
 public function contact()
 {
     $validation = Validator::make(array('name' => Input::get('name'), 'phone' => Input::get('phone'), 'email' => Input::get('email'), 'sucursal' => Input::get('sucursal'), 'mensaje' => Input::get('mensaje')), array('name' => array('required'), 'phone' => array('required'), 'email' => array('required', 'email'), 'sucursal' => array('required'), 'mensaje' => array('required')));
     if ($validation->fails()) {
         if (\Request::ajax()) {
             $messages = $validation->messages();
             return \Response::JSON(array('messages' => $messages), 400);
         }
         return \Redirect::to(\Input::get('from'))->withInput()->withErrors($validation);
     }
     $data = array('name' => Input::get('name'), 'phone' => Input::get('phone'), 'email' => Input::get('email'), 'sucursal' => Input::get('sucursal'), 'mensaje' => Input::get('enquiry'));
     /*  $to = "*****@*****.**";
             $subject = "My subject";
             $headers = "From: webmaster@example.com" . "\r\n" .
                 "CC: somebodyelse@example.com";
     
             mail($to, $subject, $data, $headers);*/
     Mail::send('emails.contacto', $data, function ($message) use($data) {
         $message->to('*****@*****.**')->from($data['name'])->subject('Welcome!');
     });
     return 'El Mensaje ha sido enviado, muchas gracias por enviarnos tus sugerencias!';
     /* $this->contactForm->validate(Input::all());
     
             $data = array( 'email' => '*****@*****.**', 'name' => 'Lar', 'from' => '*****@*****.**', 'phone' => 'Vel', 'sucursal' => 'Vel', 'mensaje' => 'Vel' );
     
             Mail::send( 'emails.contacto', $data, function( $message ) use ($data)
             {
                 $message->to( $data['email'] )->from( $data['from'])->subject( 'Welcome!' );
             });
     
             return Redirect::back()->withInput();
     //       return Input::get('name').Input::get('phone');*/
 }
Example #2
0
 public function apply()
 {
     if (\Config::get('laravel-jobs::apply') == false) {
         \App::abort(404);
     }
     $rules = array('name' => 'required', 'email' => 'required|email', 'cv' => 'mimes:' . \Config::get('laravel-jobs::cv_allowed_mimes'));
     $validator = \Validator::make(\Input::all(), $rules, \Lang::get('laravel-jobs::copy.validation'));
     $validator->sometimes('cv', 'required', function ($input) {
         return \Config::get('laravel-jobs::is_cv_required');
     });
     $validator->sometimes('letter', 'required', function ($input) {
         return \Config::get('laravel-jobs::is_covering_letter_required');
     });
     if ($validator->fails()) {
         if (\Request::ajax()) {
             $messages = $validator->messages();
             return \Response::JSON(array('messages' => $messages), 400);
         }
         return \Redirect::to(\Input::get('from'))->withInput()->withErrors($validator);
     }
     \Mail::send(\Config::get('laravel-jobs::mail.views'), \Input::all(), function ($message) {
         $message->to(\Config::get('laravel-jobs::mail.to.email'), \Config::get('laravel-jobs::mail.to.name'))->subject(\Config::get('laravel-jobs::mail.subject'));
         if (\Input::hasFile('cv')) {
             $message->attach(\Input::file('cv')->getRealPath(), array('as' => \Input::file('cv')->getClientOriginalName(), 'mime' => \Input::file('cv')->getMimeType()));
         }
     });
     return \Redirect::to(\Input::get('from'))->with('thanks_message', \Lang::get('laravel-jobs::copy.misc.sent_message'));
 }
Example #3
0
 public function delete()
 {
     $rules = array('newsletter_unsubscribe_email' => 'required|max:250|email|exists:fbf_newsletter_signups,email');
     $validator = \Validator::make(\Input::all(), $rules, \Lang::get('laravel-newsletter-signup::copy.unsubscribe.validation'));
     if ($validator->fails()) {
         if (\Request::ajax()) {
             $messages = $validator->messages();
             $message = $messages->first('newsletter_unsubscribe_email');
             return \Response::JSON(array('message' => $message), 400);
         }
         return \Redirect::to(\Input::get('from'))->withInput()->withErrors($validator);
     }
     $signup = Signup::withTrashed()->where('email', '=', \Input::get('newsletter_unsubscribe_email'))->first();
     if ($signup->trashed()) {
         if (\Request::ajax()) {
             return \Response::JSON(array('message' => \Lang::get('laravel-newsletter-signup::copy.unsubscribe.already_unsubscribed')), 400);
         }
         $message = new MessageBag();
         $message->add('newsletter_unsubscribe_email', \Lang::get('laravel-newsletter-signup::copy.unsubscribe.already_unsubscribed'));
         return \Redirect::to(\Input::get('from'))->withInput()->with('errors', $message);
     }
     $signup->delete();
     $success = \Lang::get('laravel-newsletter-signup::copy.unsubscribe.success');
     if (\Request::ajax()) {
         return \Response::JSON(array('message' => $success));
     }
     return \Redirect::to(\Input::get('from'))->with('newsletter_unsubscribe_email_message', $success);
 }
 function endpoint()
 {
     $url = Input::get('url');
     Log::info('Endpoint hit for: ' . $url);
     if (empty($url)) {
         throw new Exception("URL is empty!");
     }
     try {
         return $this->getResultsCache($url);
     } catch (\Exception $e) {
         \Log::info($e);
         return \Response::JSON(array('error' => true, 'message' => $e->getMessage()));
     }
 }
 public function send()
 {
     $rules = \Config::get('laravel-contact-form::rules');
     $validator = \Validator::make(\Input::all(), $rules, \Lang::get('laravel-contact-form::copy.validation'));
     if ($validator->fails()) {
         if (\Request::ajax()) {
             $messages = $validator->messages();
             return \Response::JSON(array('messages' => $messages), 400);
         }
         return \Redirect::to(\Input::get('from'))->withInput()->withErrors($validator);
     }
     \Mail::send(\Config::get('laravel-contact-form::mail.views'), \Input::all(), function ($message) {
         $message->to(\Config::get('laravel-contact-form::mail.to.email'), \Config::get('laravel-contact-form::mail.to.name'))->subject(\Config::get('laravel-contact-form::mail.subject'));
     });
     return \Redirect::to(\Input::get('from'))->with('contact_form_message', \Lang::get('laravel-contact-form::copy.sent_message'));
 }
 public function getProjectUsers($projectId)
 {
     $users = $this->project->find($projectId)->users()->get(array('users.id', 'first_name', 'last_name'));
     $user1 = array();
     foreach ($users as $user) {
         array_push($user1, array('id' => $user['id'], 'name' => $user['first_name'] . " " . $user['last_name']));
     }
     return Response::JSON($user1);
 }
Example #7
0
 public function postEdit()
 {
     $files = Input::file('files');
     $file = $files[0];
     //print_r($file);
     //exit();
     $rstring = str_random(8);
     $destinationPath = realpath('storage/temp') . '/' . $rstring;
     $filename = $file->getClientOriginalName();
     $filemime = $file->getMimeType();
     $filesize = $file->getSize();
     $extension = $file->getClientOriginalExtension();
     //if you need extension of the file
     $filename = str_replace(Config::get('kickstart.invalidchars'), '-', $filename);
     $uploadSuccess = $file->move($destinationPath, $filename);
     $thumbnail = Image::make($destinationPath . '/' . $filename)->fit(320, 240)->save($destinationPath . '/th_' . $filename);
     $fileitems = array();
     if ($uploadSuccess) {
         $fileitems[] = array('url' => URL::to('storage/temp/' . $rstring . '/' . $filename), 'thumbnail_url' => URL::to('storage/temp/' . $rstring . '/th_' . $filename), 'temp_dir' => $destinationPath, 'name' => $filename, 'type' => $filemime, 'size' => $filesize, 'delete_url' => 'http://url.to/delete /file/', 'delete_type' => 'DELETE');
     }
     return Response::JSON(array('files' => $fileitems));
 }
Example #8
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('registration/company', function () {
    return Response::JSON(['test' => Session::getToken()]);
});
Route::get('/test', function () {
    $event_date = '2015-10-13';
    $task = (object) ['deadline_days_gap' => -2];
    $new_deadline = strtotime(-$task->deadline_days_gap . ' days', strtotime($event_date));
    echo date('Y-m-d', $new_deadline);
    return;
    $hotel = Hotel::find(4);
    Debugbar::info($hotel);
    $venue = Venue::find(77);
    $hospitality = $venue->hospitality;
    Debugbar::info($hospitality);
    $first_hotel = $hospitality->first_hotel_option()->associate($hotel);
    $first_hotel = $hospitality->first_hotel_option()->get();
    Debugbar::info($first_hotel);
    echo 'test';
});
Example #9
0
 public function getBugDetails($id)
 {
     $bug = $this->bug->find($id);
     return Response::JSON($bug);
 }
 public function getGroupList()
 {
     $data = array('status' => true);
     $data['list'] = $this->todoGroup->getlist();
     return Response::JSON($data);
 }
Example #11
0
 /**
  * The POST method for setting a user's rows per page
  *
  * @param ModelConfig	$config
  *
  * @return JSON
  */
 public function action_rows_per_page($config)
 {
     //get the inputted rows and the model rows
     $rows = (int) Input::get('rows', 20);
     $config->setRowsPerPage($rows);
     return Response::JSON(array('success' => true));
 }
Example #12
0
 public function deleteTodo($todoId)
 {
     if ($this->todo->destroy($todoId)) {
         return Response::JSON(array('status' => 'success'));
     } else {
         return Response::JSON(array('status' => 'fail'));
     }
 }