route() public static method

Get the URL to a named route.
public static route ( string $name, mixed $parameters = [], boolean $absolute = true ) : string
$name string
$parameters mixed
$absolute boolean
return string
Beispiel #1
0
 public function addItem($perams = array())
 {
     $defaults = array('text' => '', 'URL' => '#', 'reference' => 0, 'parent' => false, 'weight' => 1, 'class' => '', 'children' => array(), 'icon' => '', 'attributes' => array(), 'protected' => false);
     if (isset($perams['URL']) && preg_match("#^route:(.*)\$#is", $perams['URL'], $match)) {
         if (isset($perams['protected']) && $perams['protected']) {
             $perams['protected'] = $match[1];
         }
         if ($this->entrust && \Auth::check()) {
             $roles = \Auth::user()->roles()->get();
             $allowed = true;
             foreach ($roles as $role) {
                 foreach ($role->perms as $perm) {
                     if (in_array($match[1], $perm->protected_routes)) {
                         $perams['URL'] = \URL::route($match[1]);
                         $this->items[] = array_merge($defaults, $perams);
                     }
                 }
             }
             return $this;
         } else {
             $perams['URL'] = \URL::route($match[1]);
         }
     }
     $this->items[] = array_merge($defaults, $perams);
     return $this;
 }
Beispiel #2
0
 /**
  * Make a EWAY payment to the destined user from the main business account.
  *
  * @return void
  */
 protected function makePayment()
 {
     $receiver = Input::get('number');
     $amounttosend = Input::get('amount');
     $currency = Input::get('currency');
     $destinationProvider = Input::get('target');
     $charges = new PlatformCharges($amounttosend, $currency, $destinationProvider);
     $desc = $charges->getReceiverType($destinationProvider);
     $user = User::find(Auth::user()->id);
     $transaction = ['Customer' => ['FirstName' => Auth::user()->name, 'Street1' => 'Level 5', 'Country' => 'US', 'Mobile' => Auth::user()->number, 'Email' => Auth::user()->email], 'Items' => [['SKU' => mt_rand(), 'Description' => 'Hybrid Transfer from EWAY to ' . $desc . ' user', 'Quantity' => 1, 'UnitCost' => $charges->convertCurrency($currency, 'AUD', $charges->getDueAmount('ew', $destinationProvider)), 'Tax' => 100]], 'Options' => [['Value' => $desc], ['Value' => $receiver], ['Value' => 'AUD'], ['Value' => 0.01 * $amounttosend]], 'Payment' => ['TotalAmount' => $charges->convertCurrency($currency, 'AUD', $charges->getDueAmount('ew', $destinationProvider)) * 100, 'CurrencyCode' => 'AUD'], 'Method' => 'ProcessPayment', 'RedirectUrl' => URL::route('dashboard') . '/ewayconfirm', 'CancelUrl' => URL::route('dashboard') . '/ewaycancel', 'PartnerID' => EwayController::$_EWAY_CUSTOMER_ID, 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, 'Capture' => true, 'LogoUrl' => 'https://izepay.iceteck.com/public/images/logo.png', 'HeaderText' => 'Izepay Money Transfer', 'Language' => 'EN', 'CustomView' => 'BootstrapCerulean', 'VerifyCustomerEmail' => true, 'Capture' => true, 'CustomerReadOnly' => false];
     try {
         $response = $this->client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);
         //var_dump($response);
         //                echo $response->SharedPaymentUrl;
         //sleep(20);
     } catch (Exception $ex) {
         return Redirect::route('dashboard')->with('alertError', 'Debug Error: ' . $ex->getMessage());
     }
     //manage response
     if (!$response->getErrors()) {
         // Redirect to the Responsive Shared Page
         header('Location: ' . $response->SharedPaymentUrl);
         //die();
     } else {
         foreach ($response->getErrors() as $error) {
             //echo "Response Error: ".\Eway\Rapid::getMessage($error)."<br>";
             return Redirect::route('dashboard')->with('alertError', 'Error! ' . \Eway\Rapid::getMessage($error));
         }
     }
 }
 /**
  * This function create employee
  * when data is posted from 
  * /admin/employee/create
  */
 public function postCreate()
 {
     // Check validation
     $validator = Validator::make(Input::all(), Employee::$rulesForCreate, Employee::$messages);
     // If failed then redirect to employee-create-get route with
     // validation error and input old
     if ($validator->fails()) {
         return Redirect::route('employee-create-get')->withErrors($validator)->withInput();
     }
     // If validation is not failed then create employee
     $employee = Employee::create(array('first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'age' => Input::get('age'), 'gender' => Input::get('gender'), 'DOB' => DateFormat::store(Input::get('DOB')), 'present_address' => Input::get('present_address'), 'permanent_address' => Input::get('permanent_address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'country' => Input::get('country'), 'mobile_no' => Input::get('mobile_no'), 'email' => Input::get('email'), 'created_by' => Session::get('username')));
     // Also create user account for the employee
     $user = User::create(array('details_id' => $employee->id, 'username' => Input::get('username'), 'email' => $employee->email, 'user_level' => Input::get('userlevel'), 'active' => 0));
     // generate random code and password
     $password = str_random(10);
     $code = str_random(60);
     $newHashPassword = Hash::make($password);
     // Save new password and code
     $user->password_tmp = $newHashPassword;
     $user->activation_code = $code;
     if ($user->save()) {
         // Send email to the employee.
         // This email contains username,password,activation link
         Mail::send('emails.auth.activation', array('first_name' => $employee->first_name, 'last_name' => $employee->last_name, 'username' => $user->username, 'password' => $password, 'activation_link' => URL::route('activation-get', $code)), function ($message) use($user) {
             $message->to($user->email, $user->username)->subject('Confirm Activation');
         });
     }
     return View::make('adminArea.employee.create')->with('success', 'Activation link has been sent successfully');
 }
 public function profileSave()
 {
     $json_request = array('status' => FALSE, 'responseText' => '', 'redirectURL' => FALSE);
     $validator = Validator::make(Input::all(), Accounts::$update_rules);
     if ($validator->passes()) {
         $post = Input::all();
         if (self::accountUpdate($post)) {
             $result = self::crmAccountUpdate($post);
             if ($result === -1) {
                 Auth::logout();
                 $json_request['responseText'] = Config::get('api.message');
                 $json_request['redirectURL'] = pageurl('auth');
                 return Response::json($json_request, 200);
             }
             $json_request['redirectURL'] = URL::route('dashboard');
             $json_request['responseText'] = Lang::get('interface.DEFAULT.success_save');
             $json_request['status'] = TRUE;
         } else {
             $json_request['responseText'] = Lang::get('interface.DEFAULT.fail');
         }
     } else {
         $json_request['responseText'] = $validator->messages()->all();
     }
     if (Request::ajax()) {
         return Response::json($json_request, 200);
     } else {
         return Redirect::route('dashboard');
     }
 }
 public function onSend($event)
 {
     $message = $event->message;
     $body = $message->getBody();
     $subject = $message->getSubject();
     $to = key($message->getTo());
     @($bcc = key($message->getBcc()));
     if (isset($bcc) && !empty($bcc) && $bcc == \Config::get('maillog.bcc')) {
     } else {
         try {
             $mailLog = MailLog::where('to', $to)->where('subject', $subject)->where('body', strip_tags($body))->firstOrFail();
             if (isset($bcc) && !empty($bcc) && $bcc == \Config::get('maillog.bcc_delay') && strtotime($mailLog['sended_at']) < strtotime('- ' . \Config::get('maillog.delay') . ' minutes')) {
                 $mailLog->sended_at = date('Y-m-d H:i:s', time());
             } else {
                 $message->setTo('null@null');
                 $message->setBody('');
                 $message->setFrom([]);
             }
             $mailLog->attempt += 1;
             $mailLog->save();
         } catch (ModelNotFoundException $e) {
             $mailLog = new MailLog();
             $mailLog->to = $to;
             $mailLog->subject = $subject;
             $mailLog->body = strip_tags($body);
             $mailLog->sended_at = date('Y-m-d H:i:s', time());
             $mailLog->save();
             $body = $body . '<img src="' . \URL::route('MailRead', $mailLog['id']) . '" height="1px" width="1px">';
             $message->setBody($body);
         }
     }
     $message->setBcc([]);
 }
 public function SendEmail()
 {
     /*
      * validate the Inputs sent
      */
     $rules = array('email_cc' => "required_if:email_to,''|required_if:email_bcc,''", 'email_to' => "required_if:email_cc,''|required_if:email_bcc,''", 'email_bcc' => "required_if:email_cc,''|required_if:email_to,''", 'message' => 'required', 'subject' => 'required');
     $messages = array("required_without" => "Please select atleast one recipient", "subject.required" => "Please enter message subject", "message.required" => "Please enter message to send");
     $validator = Validator::make(Input::all(), $rules, $messages);
     $messages = $validator->messages();
     if ($validator->fails()) {
         return Redirect::to(URL::previous())->withErrors($validator)->withInput();
     } else {
         if (Conversation::saveEmail()) {
             Session::flash('_feedback', '<div class="alert alert-info alert-dismissable">
                             <i class="fa fa-info"></i>
                             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><b>Alert!</b>
                             Email has been successfully queued for sending</div>');
             //Helpers::uploadCampaignFile(Input::file('attachment'), $attachment_ref);
             return Redirect::to(URL::route('conversation'));
         } else {
             Session::flash('_feedback', '<div class="alert alert-info alert-dismissable">
                             <i class="fa fa-info"></i>
                             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><b>Alert!</b>
                             Error occured, please try again later</div>');
             return Redirect::to(URL::route('conversation'));
         }
     }
 }
Beispiel #7
0
 /**
  * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
  */
 public function testDeleteFailNotAnOwner()
 {
     $user = $this->createUser('*****@*****.**');
     $pad = $user->pads()->save(new Pad(array('name' => 'pad')));
     $this->be($this->createUser('*****@*****.**'));
     $crawler = $this->client->request('POST', URL::route('pads.destroy', array('id' => $pad->id)));
 }
Beispiel #8
0
 public function ajaxPlans()
 {
     $arr = array();
     $plans = Plan::where('mr_id', \Auth::user()->id)->approved()->get();
     $leave = LeaveRequest::where('mr_id', \Auth::user()->id)->approved()->get();
     $i = 0;
     foreach ($plans as $singlePlan) {
         $arr[$i]['start'] = $singlePlan['date'];
         $arr[$i]['title'] = $singlePlan->comment ? $singlePlan->comment : '';
         $arr[$i]['color'] = 'black';
         $i++;
         foreach (json_decode($singlePlan['doctors']) as $singleDoctorId) {
             $color = $this->isDoctorVisited($singleDoctorId, $singlePlan['date']) == true ? 'green' : 'red';
             $url = $this->isDoctorVisited($singleDoctorId, $singlePlan['date']) != true ? \URL::route('addReport', $singleDoctorId) : NULL;
             $arr[$i]['url'] = $url;
             $arr[$i]['title'] = Customer::findOrFail($singleDoctorId)->name;
             $arr[$i]['start'] = $singlePlan['date'];
             $arr[$i]['color'] = $color;
             $i++;
         }
     }
     foreach ($leave as $singleLeave) {
         $arr[$i]['title'] = 'Holiday';
         $arr[$i]['start'] = $singleLeave['leave_start'];
         $arr[$i]['end'] = date('Y-m-d', strtotime($singleLeave['leave_end'] . "+1 days"));
         $arr[$i]['color'] = '#9b59b6';
         $arr[$i]['allDay'] = true;
         $i++;
     }
     return json_encode($arr);
 }
Beispiel #9
0
 /**
  * Send a welcome email to a user
  */
 private function sendWelcome($email, $password)
 {
     //send notification email
     return Mail::send('avalon::emails.welcome', array('email' => $email, 'password' => $password, 'link' => URL::route('home')), function ($message) use($email) {
         $message->to($email)->subject(trans('avalon::messages.users_welcome_subject'));
     });
 }
 public function forgotpasswordpost()
 {
     Session::put('mailsend', 'we have some issue please try again');
     $validater = Validator::make(Input::all(), array('email' => 'Required|email'));
     if ($validater->fails()) {
         Redirect::route('forgot-password')->withErrors($validater)->withInput();
     } else {
         $user = User::where('email', '=', Input::get('email'));
         if ($user->count()) {
             $user = $user->first();
         }
         //generate a new code
         $code = str_random(60);
         $user->code = $code;
         //$sendcode=NULL;
         if ($user->save()) {
             $sendcode = Mail::send('emails.auth.recover', array('link' => URL::route('account-recover', $code), 'username' => $user->name), function ($message) use($user) {
                 $message->to($user->email, 'hello user')->subject('Your new Password')->from('*****@*****.**');
             });
             Session::put('mailsend', 'We have sent you an activation code on your mail. Thanx.');
             return Redirect::route('login');
             //return URL::route('account-recover').'/'.$code;
             // return 'successful';
         }
     }
     return Redirect::route('forgot-password');
 }
 public static function generateSitemap($reGenerate = false)
 {
     // create new sitemap object
     $sitemap = App::make("sitemap");
     $sitemap->setCache('laravel.sitemap', 3600);
     if ($reGenerate) {
         Cache::forget($sitemap->model->getCacheKey());
     }
     // check if there is cached sitemap and build new only if is not
     if (!$sitemap->isCached()) {
         // add item to the sitemap (url, date, priority, freq)
         $sitemap->add(URL::to('/'), null, '1.0', 'daily');
         $categories = Category::get();
         foreach ($categories as $category) {
             $sitemap->add(URL::route('category', [$category->slug]), null, '1.0', 'daily');
         }
         // get all lists from db
         $lists = ViralList::orderBy('created_at', 'desc')->get();
         // add every post to the sitemap
         foreach ($lists as $list) {
             $sitemap->add(ListHelpers::viewListUrl($list), $list->updated_at, '1.0', 'monthly');
         }
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     return $sitemap->render('xml');
 }
Beispiel #12
0
 public function handleRegister()
 {
     $validator = Validator::make(Input::all(), array('username' => 'required|unique:users|alpha_dash|min:4', 'email' => 'required|email|unique:users', 'country' => 'required', 'number' => 'required|numeric|min:9', 'password' => 'required|alpha_num|min:6', 'confirm_password' => 'required|alpha_num|same:password', 'terms' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('home')->withErrors($validator)->withInput();
     } else {
         $username = Input::get('username');
         $email = Input::get('email');
         $number = Input::get('number');
         $password = Input::get('password');
         $country = Input::get('country');
         $newsletter = Input::has('newsletter') ? 1 : 0;
         //Activation code
         $code = str_random(60);
         //Account email
         try {
             Mail::send('emails.auth.registration', array('link' => URL::route('account-activate', $code), 'username' => $username), function ($message) use($email, $username) {
                 $message->to($email, $username)->subject('Account activation');
             });
             $user = User::create(array('username' => $username, 'email' => $email, 'number' => $number, 'password' => Hash::make($password), 'country' => $country, 'newsletter' => $newsletter, 'code' => $code, 'active' => 0));
             return Redirect::route('home')->with('alertMessage', 'Your account has been created! We have sent you an email to verify and activate your account.');
         } catch (Exception $ex) {
             return Redirect::route('home')->with('alertError', 'Error! ' . $ex->getMessage() . '. Please try again later');
         }
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::guard($guard)->check()) {
         return redirect(\URL::route('customers'));
     }
     return $next($request);
 }
 public function resetAction()
 {
     $token = "?token=" . Input::get("token");
     $errors = new MessageBag();
     if ($old = Input::old("errors")) {
         $errors = $old;
     }
     $data = ["token" => $token, "errors" => $errors];
     if (Input::server("REQUEST_METHOD") == "POST") {
         $validator = Validator::make(Input::all(), ["email" => "required|email", "password" => "required|min:6", "password_confirmation" => "required|same:password", "token" => "required|exists:token,token"]);
         if ($validator->passes()) {
             $credentials = ["email" => Input::get("email")];
             Password::reset($credentials, function ($user, $password) {
                 $user->password = Hash::make($password);
                 $user->save();
                 Auth::login($user);
                 return Redirect::route("user/profile");
             });
         }
         $data["email"] = Input::get("email");
         $data["errors"] = $validator->errors();
         return Redirect::to(URL::route("user/reset") . $token)->withInput($data);
     }
     return View::make("user/reset", $data);
 }
Beispiel #15
0
 public function delete($id)
 {
     $check = Check::findOrFail($id);
     $check->delete();
     Session::flash('info', trans('check.delete.success', array('url' => $check->url, 'restoreUrl' => URL::route('check.restore', array('id' => $check->id)))));
     return Redirect::route('check.index');
 }
 public function postPayment($producto_id)
 {
     $producto = Producto::find($producto_id);
     if (is_null($producto)) {
         App::abort(404);
     }
     $productoYaComprado = User::find(Auth::user()->id)->Productos()->whereProducto_id($producto->id)->first();
     if (!is_null($productoYaComprado)) {
         App::abort(404);
     }
     \Session::put('producto_id', $producto_id);
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $items = array();
     $subtotal = 0;
     $currency = 'MXN';
     $item = new Item();
     $item->setName($producto->nombre)->setCurrency($currency)->setDescription($producto->nombre)->setQuantity(1)->setPrice($producto->precio);
     $items[] = $item;
     $subtotal += $producto->precio;
     $item_list = new ItemList();
     $item_list->setItems($items);
     $details = new Details();
     $details->setSubtotal($subtotal);
     //->setShipping(100);
     //$total = $subtotal + 100;
     $total = $subtotal;
     $amount = new Amount();
     $amount->setCurrency($currency)->setTotal($total)->setDetails($details);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             return \Redirect::route('home')->with('message', 'Algo salió mal, inténtalo de nuevo más tarde.');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::route('home')->with('message', 'Ups! Error desconocido. Inténtalo de nuevo más tarde.');
 }
Beispiel #17
0
 public function postRegister()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Membership' => 'required', 'First_Name' => 'required|max:50', 'Last_Name' => 'required|max:50', 'Email' => 'required|max:50|email', 'Confirm_Email' => 'required|same:Email', 'Password' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('register')->withErrors($validator)->withInput();
     } else {
         $membership = Input::get('Membership');
         $firstname = Input::get('First_Name');
         $lastname = Input::get('Last_Name');
         $email = Input::get('Email');
         $password = Input::get('Password');
         //generate the activation codes
         $code = str_random(60);
         $user = NULL;
         $main_user = NULL;
         //check the membership type and update the correct database
         $main_user = User::create(array('type' => $membership, 'email' => $email, 'password' => Hash::make($password), 'code' => $code, 'active' => 0));
         if ($main_user) {
             //register the new user
             $user = $membership::create(array('user_id' => $main_user->id, 'firstname' => $firstname, 'lastname' => $lastname));
             if ($user) {
                 Mail::send('emails.auth.activate', array('link' => URL::route('account-activation-get', $membership . '/' . $code), 'password' => $password), function ($message) use($user) {
                     $message->to($user->email)->subject('Activate Your Account');
                 });
                 return Redirect::route('register')->with('email_sent_success', 'Activation Successful')->with('global', 'Your Account Has Been Created Successfully.<br />An activation link has been sent your Email:' . $email);
             }
         }
     }
     return Redirect::route('register')->with('global', 'Failed! Please Try Again');
 }
 public function before()
 {
     // set default route
     URL::route('frontend');
     Text::language('nl');
     Text::instance('nl')->load($this->request->controller())->group($this->request->controller())->substitutes('module');
 }
 public function postRegister()
 {
     $validator = Validator::make(Input::all(), array('fullname' => 'required|max:250|min:5', 'hotelname' => 'required|max:250', 'email' => 'required|max:250|email|unique:person', 'username' => 'required|max:250|min:5|unique:person', 'password' => 'required|min:5', 'confirm-password' => 'required|same:password'));
     if ($validator->fails()) {
         return Redirect::route('register-account')->withErrors($validator)->withInput();
     } else {
         $updatedCompanyId = DB::table('company')->max('company_id');
         $fullname = Input::get('fullname');
         $hotelname = Input::get('hotelname');
         $email = Input::get('email');
         $username = Input::get('username');
         $password = Input::get('password');
         $mytime = Carbon\Carbon::now();
         $code = str_random(60);
         $updatedId = DB::table('person')->insertGetId(['username' => $username, 'full_name' => $fullname, 'email' => $email, 'password' => Hash::make($password), 'code' => $code, 'active' => 0, 'company_name' => $hotelname, 'role' => 'hotel-admin', 'comp_id' => $updatedCompanyId, 'created_at' => $mytime->toDateTimeString(), 'updated_at' => $mytime->toDateTimeString()]);
         if ($updatedId) {
             $data = array('email' => $email, 'username' => $username, 'link' => URL::route('account-activate', $code));
             Mail::send('emails.auth.activate', $data, function ($message) use($data) {
                 $message->to($data['email'])->subject('Activate Your Account');
             });
             return Redirect::route('link-sent');
         } else {
             return Redirect::route('register-account');
         }
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // create new sitemap object
     $sitemap = App::make("sitemap");
     // set cache (key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean))
     // by default cache is disabled
     $sitemap->setCache('laravel.sitemap', 3600);
     // check if there is cached sitemap and build new only if is not
     if (!$sitemap->isCached()) {
         // add item to the sitemap (url, date, priority, freq)
         $sitemap->add(URL::route('index'), '2015-04-18T12:24:11+00:00', '1.0', 'daily');
         // get all posts from db
         $schools = School::all();
         // add every post to the sitemap
         foreach ($schools as $school) {
             $images = array(array('url' => $school->cover_photo_url, 'title' => $school->name, 'caption' => $school->name));
             foreach ($school->photos_data as $image) {
                 $images[] = array('url' => $image->photo_url, 'title' => $school->name, 'caption' => $image->name);
             }
             $sitemap->add($school->school_url, $school->updated_at, '0.9', 'daily', $images);
         }
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     return $sitemap->render('xml');
 }
 public function index($id)
 {
     $post = $this->postRepository->findById($id);
     if (!$post or !$post->present()->canView()) {
         if (\Request::ajax()) {
             return '';
         }
         return $this->theme->section('error-page');
     }
     $this->theme->share('site_description', $post->text ? \Str::limit($post->text, 100) : \Config::get('site_description'));
     $this->theme->share('ogUrl', \URL::route('post-page', ['id' => $post->id]));
     if ($post->text) {
         $this->theme->share('ogTitle', \Str::limit($post->text, 100));
     }
     if ($post->present()->hasValidImage()) {
         foreach ($post->present()->images() as $image) {
             $this->theme->share('ogImage', \Image::url($image, 600));
         }
     }
     $ad = empty($post->text) ? trans('post.post') : str_limit($post->text, 60);
     $design = [];
     if ($post->page_id) {
         $design = $post->page->present()->readDesign();
     } elseif ($post->community_id) {
         $design = $post->community->present()->readDesign();
     } else {
         $design = $post->user->present()->readDesign();
     }
     return $this->render('post.page', ['post' => $post], ['title' => $this->setTitle($ad), 'design' => $design]);
 }
 public function getGraphData()
 {
     if (Sentry::getUser()) {
         $user_id = Sentry::getUser()->id;
         $period = Input::get('check_report_period');
         $mongo_id = Input::get('report_mongo_id');
         $check_id = Input::get('report_check_id');
         $mongoAPI = new MongoAPI();
         $checkAlertEmail = new CheckAlertEmail();
         $data = json_decode($mongoAPI->getServerModelData($mongo_id, $period), true);
         $data['alert'] = $checkAlertEmail->getDataByCheckId($check_id);
         return Response::json($data);
     } else {
         try {
             $user = Sentry::findUserById(Input::get('user_id'));
             $emf_group = Sentry::findGroupByName('EmfUsers');
             if ($user->inGroup($emf_group)) {
                 return $this->get_exired_message(Config::get('kuu.emf_login_page'));
             } else {
                 return $this->get_exired_message(URL::route('login'));
             }
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return $this->get_exired_message(URL::route('login'));
         } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
             return $this->get_exired_message(URL::route('login'));
         }
     }
 }
Beispiel #23
0
 public function setActive()
 {
     $type = \Request::query('type', 'frontend');
     $theme = \Request::query('theme', 'default');
     $this->themeRepository->setActive($type, $theme);
     return \Redirect::to(\URL::route('admincp-theme') . '?type=' . $type);
 }
 public function create()
 {
     // get transferred_at
     // $transferred_at = explode('-', Input::get('transferred_at'));
     // $transferred_at = mktime(0,0,0,$transferred_at[1],$transferred_at[0],$transferred_at[2]);
     $transferred_at = strtotime(Input::get('transferred_at'));
     // get input
     $input = array('user_id' => Auth::user()->id, 'currency' => Input::get('currency'), 'total' => Input::get('total'), 'transferred_at' => $transferred_at, 'to_bank' => Input::get('to_bank'), 'bank_name' => Input::get('bank_name'), 'bank_account' => Input::get('bank_account'), 'bank_account_name' => Input::get('bank_account_name'), 'message' => Input::get('message'), 'donation_ids' => Input::get('donation_ids'));
     $result = Payment::add($input);
     if ($result['success']) {
         Session::flash('success', 'Proses konfirmasi pengiriman donasi Anda berhasil. Selanjutnya kami mohon kesediaan Anda untuk menunggu Admin BagiKasih melakukan verifikasi. BagiKasih akan mengirim Anda email jika proses verivikasi telah dilakukan. Terima kasih.');
         if (Request::ajax()) {
             return Response::json(['success' => true, 'redirect_url' => URL::route('riwayat-donasi')]);
         } else {
             return $result;
         }
     } else {
         // if fail
         if (Request::ajax()) {
             return Response::json(json_encode($result));
         } else {
             return $result;
         }
     }
     return $result;
 }
Beispiel #25
0
 /**
  * @param $id
  * @return array cu cateva particularitati ale obiectului instantiat
  */
 public function toIndexConfig($id)
 {
     //        aici in $this->grids[$id] avem stabilita deja instanta obiectului particular pentru creare
     $record = $this->grids[$id];
     $result = ['id' => $record->id, 'view' => $record->view, 'ngCtrl' => $record->ngCtrl, 'name' => $record->name, 'display-start' => $record->display_start, 'display-length' => $record->display_length, 'default-order' => $record->default_order, 'row-source' => \URL::route($record->row_source, ['id' => $record->id]), 'dom' => $record->dom, 'columns' => $record->columns(), 'caption' => $record->caption, 'icon' => $record->icon, 'toolbar' => $record->toolbar, 'form' => $record->form, 'custom_styles' => $record->css, 'custom_scripts' => $record->js, 'breadcrumbs' => $record->breadcrumbs, 'right_menu' => $record->right_menu];
     return $result;
 }
Beispiel #26
0
 public function editHandle()
 {
     $user = Auth::user();
     $nice_input_names = array('firstname' => trans('auth.firstname'), 'lastname' => trans('auth.lastname'));
     $data = ['firstname' => e(Input::get('firstname')), 'lastname' => e(Input::get('lastname'))];
     $rules = ['firstname' => 'alpha|min:2', 'lastname' => 'alpha|min:2'];
     $email_changed = false;
     if (e(Input::get('email')) != $user->email) {
         $data['email'] = e(Input::get('email'));
         $rules['email'] = 'required|email|unique:users,email,' . $user->id;
         $email_changed = true;
     }
     $validator = $validator = Validator::make($data, $rules, [], $nice_input_names);
     if ($validator->passes()) {
         $user->firstname = e(Input::get('firstname'));
         $user->lastname = e(Input::get('lastname'));
         if ($email_changed) {
             $confirmation_code = str_random(30);
             $user->email = e(Input::get('email'));
             $user->confirmed = 0;
             $user->confirmation_code = $confirmation_code;
             $data = ['body_message' => trans('auth.welcome_body'), 'confirmation_code' => $confirmation_code];
             $email_tpl = trans('auth.welcome') . ' ' . $data['body_message'] . ' ' . ' ' . URL::route('verify-register', [$data['confirmation_code']]);
             if (mail(e(Input::get('email')), trans('auth.welcome_subject'), HTML::decode($email_tpl))) {
                 $user->save();
                 return Redirect::route('logout');
             }
         }
         $user->save();
         return Redirect::back()->with('success', trans('user.account_updated'));
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
Beispiel #27
0
 /**
  * Testing Lot create method
  */
 public function testCreate()
 {
     $url = URL::route('lot.create');
     // Set the current user to admin
     $this->be(User::first());
     $this->visit($url)->see('instruments');
 }
 public function postForgotPassword()
 {
     $valid = Validator::make(Input::all(), array('email' => 'required|email'));
     if (!$valid->fails()) {
         $user = User::where('email', '=', Input::get('email'));
         if ($user->count()) {
             $user = $user->first();
             if ($user->active == 1) {
                 $code = str_random(60);
                 $password = str_random(10);
                 $user->code = $code;
                 $user->password_temp = Hash::make($password);
                 if ($user->save()) {
                     $email = Mail::send('emails.forgotpassword', array('name' => $user->name, 'link' => URL::route('forgot-password-activate', array('user' => $user->id, 'code' => $code)), 'password' => $password), function ($message) use($user) {
                         $message->to($user->email, $user->name)->subject('Your new password');
                     });
                     if ($email) {
                         return Redirect::route('forgot-password')->with('success', true);
                     }
                     return Redirect::route('forgot-password')->withInput()->with('error', 'unexpected-error');
                 }
                 return Redirect::route('forgot-password')->withInput()->with('error', 'unexpected-error');
             }
             return Redirect::route('forgot-password')->withInput()->with('error', 'inactive-account');
         }
         return Redirect::route('forgot-password')->withInput()->with('error', 'account-doesnt-exist');
     }
     return Redirect::route('forgot-password')->withInput()->with('error', 'invalid-email');
 }
 public function doRegistration()
 {
     // Setup the validator
     $validator = Validator::make(Input::all(), array('name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required', 'password_confirm' => 'required|same:password', 'phone' => 'required', 'confirm' => 'required'), array('email.unique' => "The email address you entered is already registered. You can <a href='" . \URL::route('home') . "'>log in</a>, or, if you've forgotten your password, you can reset it from the <a href='" . \URL::to('password/remind') . "'>Reset Password</a> page."));
     // Validator failed
     if (!$validator->passes()) {
         // Flash the session
         Session::flash('registerMessage', "Your information couldn't be validated. Please correct the issues and try again.");
         return Redirect::route('register')->withInput()->withErrors($validator->errors());
     }
     // Make sure the confirmation number matches
     if (Input::get('confirm') != Session::get('confirmNumber')) {
         return Redirect::route('register')->with('message', "Registration failed due to incorrect anti-spam confirmation number.")->with('messageStatus', 'danger');
     }
     // Create the user
     $user = $this->user->create(Input::all());
     if ($user) {
         // Log the user in
         Auth::login($user, true);
         // Fire the registration event
         Event::fire('user.registered', array($user, Input::all()));
         return Redirect::route('home')->with('message', "Welcome to the Brian Jacobs Golf scheduler! An email has been sent with the log in information you entered during registration. If you don't see the email, make sure to check your spam folder. From the scheduler, you can book lessons with a Brian Jacobs Golf instructor and enroll in any of our programs. Get started today by booking a lesson or enrolling in a program!")->with('messageStatus', 'success');
     } else {
         return Redirect::route('register')->withInput()->with('registerMessage', "There was an error creating your account. Please try again!");
     }
 }
Beispiel #30
0
 public function postPayment()
 {
     $data = array();
     if (is_array(Input::get('room_id'))) {
         foreach (Input::get('room_id') as $key => $val) {
             $data[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
         }
     }
     $data2 = array();
     if (is_array(Input::get('add_Am'))) {
         foreach (Input::get('add_Am') as $key => $val) {
             $data2[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
         }
     }
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $name = Input::get('packname');
     $price = Input::get('amount');
     $input_dFrom = Input::get('package_datefrom');
     $input_dTo = Input::get('package_dateto');
     $input_nPax = Input::get('num_pax');
     $input_fName = Input::get('fullN');
     $postData = new Reservation();
     $postData->dataInsertPost($name, $price, $input_dFrom, $input_dTo, $input_nPax, $input_fName, json_encode($data), 'PayPal', json_encode($data2));
     $item_1 = new Item();
     $item_1->setName($name)->setCurrency('PHP')->setQuantity('1')->setPrice(intval($price));
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('PHP')->setTotal(intval($price));
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     //        $redirect_urls->setReturnUrl(URL::to('/dashboard/accommodation'))
     //            ->setCancelUrl(URL::to('/dashboard/accommodation'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (PayPal\Exception\PayPalConnectionException $e) {
         echo $e->getData();
         // This will print a JSON which has specific details about the error.
         exit;
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         return json_encode(['url' => $redirect_url]);
     }
     return Redirect::route('dashboard.packages.accommodation')->with('error', 'Unknown error occurred');
 }