/**
  * @param array $parameters
  *
  * @return string
  */
 public static function render(array $parameters)
 {
     list($sortColumn, $sortParameter, $title, $queryParameters) = self::parseParameters($parameters);
     $title = self::applyFormatting($title);
     $icon = Config::get('columnsortable.default_icon_set');
     foreach (Config::get('columnsortable.columns') as $value) {
         if (in_array($sortColumn, $value['rows'])) {
             $icon = $value['class'];
         }
     }
     if (Request::get('sort') == $sortParameter && in_array(Request::get('order'), ['asc', 'desc'])) {
         $icon .= Request::get('order') === 'asc' ? Config::get('columnsortable.asc_suffix', '-asc') : Config::get('columnsortable.desc_suffix', '-desc');
         $direction = Request::get('order') === 'desc' ? 'asc' : 'desc';
     } else {
         $icon = Config::get('columnsortable.sortable_icon');
         $direction = Config::get('columnsortable.default_direction_unsorted', 'asc');
     }
     $iconAndTextSeparator = Config::get('columnsortable.icon_text_separator', '');
     $clickableIcon = Config::get('columnsortable.clickable_icon', false);
     $trailingTag = $iconAndTextSeparator . '<i class="' . $icon . '"></i>' . '</a>';
     if ($clickableIcon === false) {
         $trailingTag = '</a>' . $iconAndTextSeparator . '<i class="' . $icon . '"></i>';
     }
     $anchorClass = self::getAnchorClass();
     $queryString = http_build_query(array_merge($queryParameters, array_filter(Request::except('sort', 'order', 'page')), ['sort' => $sortParameter, 'order' => $direction]));
     return '<a' . $anchorClass . ' href="' . url(Request::path() . '?' . $queryString) . '"' . '>' . htmlentities($title) . $trailingTag;
 }
Beispiel #2
0
 public function createUsers()
 {
     $inputs = Request::all();
     $userTypes = Request::get('userType');
     // Checking permission of user before creating new users
     $emails = json_decode(Request::input('users'));
     foreach ($emails as $email) {
         Log::info('username - ' . $email);
         $password = str_random(10);
         DB::table('users')->insert(['name' => $email, 'email' => $email, 'password' => bcrypt($password), 'type' => 'caller']);
         foreach ($userTypes as $userType) {
             // Making a 'userType' user
             $user = \App\User::where('name', '=', $email)->first();
             $caller = \App\Role::where('name', '=', $userType)->first();
             // role attach alias
             $user->attachRole($caller);
             // parameter can be an Role object, array, or id
         }
         $data = array('name' => $email, 'username' => $email, 'password' => $password);
         // Would sent a link to the user to activate his account
         // $this->sendLink($email);
         // \Mail::send('mail.email', $data, function ($message) use ($data) {
         //   $message->subject('Login Details ')
         //           ->to('*****@*****.**');
         // });
     }
     return view('create-users', ['page' => 'create-users']);
 }
 public function anyIndex()
 {
     //获取路由传入的参数
     //echo Route::input('name');
     //获取配置信息
     $value = config('app.timezone');
     //var_dump($value);
     //获取请求输入  http://host-8/web/user?name=dfse  输出:dfse
     $name1 = Request::has('name') ? Request::get('name') : '';
     //取得特定输入数据,若没有则取得默认值
     $name2 = Request::input('name', '默认值');
     $input = Request::all();
     //所有的
     $input = Request::input('products.0.name');
     //重定向
     //return redirect('login');
     //获取cookie
     $value = Request::cookie('name');
     //获取域名
     $url = Request::root();
     //		echo $url;
     $data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
     //响应视图   响应最常用的几个方法:make/view/json/download/redirectTo
     return response()->view('user.user', $data);
 }
 /**
  * Get a collection of programmes listed by letter, using a cached record if it exists
  * @param  string $letter The letter for which to query the programmes
  * @return \Illuminate\Support\Collection 
  */
 public function getProgrammes($letter)
 {
     $page = Request::get('page', 1);
     return $this->cache->remember("bbc.programmes.{$letter}.page.{$page}", \Config::get('cache.remember_time'), function () use($letter) {
         return $this->bbc_api_client->getProgrammes($letter);
     });
 }
Beispiel #5
0
 function CitiesAutocomplete()
 {
     Request::setMethod('GET');
     $stateCode = Request::get('stateCode', "");
     $stateCode = filter_var($stateCode, FILTER_SANITIZE_STRING);
     $cityName = Request::get('cityName', "");
     $cityName = filter_var($cityName, FILTER_SANITIZE_STRING);
     //
     $cityResult = [];
     if ("" != $cityName) {
         $cities = DB::table('cache_gulliver_states')->select('cities')->where('code', $stateCode)->get();
         $cities = json_decode($cities[0]->cities);
         foreach ($cities as $city) {
             if ($city->name == $cityName) {
                 $cityResult = $city;
                 break;
             }
         }
         return Response::json($cityResult, 200);
     } else {
         $cities = DB::table('cache_gulliver_states')->select('cities')->where('code', $stateCode)->get();
         if (true == empty($cities[0]->cities)) {
             $cities = Gulliver::getCities('AR', $stateCode);
             DB::table('cache_gulliver_states')->where('code', $stateCode)->update(['cities' => json_encode($cities)]);
         } else {
             $cities = json_decode($cities[0]->cities);
         }
         return Response::json($cities, 200);
     }
 }
Beispiel #6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(LoginAndRegisterFormRequest $request)
 {
     if (Request::isMethod('post')) {
         User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]);
     }
     return Redirect::to('/auth/login')->with('successfullyRegistered', 'Konto utworzone. Zaloguj się.');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $inputs = Request::all();
     $reglas = array('nombre' => 'required', 'correo' => 'email', 'comentarios' => 'required|max:300');
     $mensajes = array('required' => trans('error.requerido'), 'email' => trans('error.correo'));
     $validar = Validator::make($inputs, $reglas, $mensajes);
     if ($validar->fails()) {
         //return back('#gracias')->withErrors($validar)->withInput();
         return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '#about')->withErrors($validar)->withInput();
     } else {
         $contacto = new Contacto();
         $contacto->email = Request::get('correo');
         $contacto->save();
         $contactName = Request::get('nombre');
         $contactEmail = Request::get('correo');
         $contactMessage = Request::get('comentarios');
         $contactAddres = Request::get('direccion');
         $data = array('name' => $contactName, 'email' => $contactEmail, 'description' => $contactMessage, 'addres' => $contactAddres);
         Mail::send('layouts.email', $data, function ($message) use($contactEmail, $contactName) {
             $message->from($contactEmail, $contactName);
             $message->to('*****@*****.**', 'Contacto Fundacion Vive Mejor')->subject('Solicitud vía WEB');
             $message->cc($contactEmail, $contactName);
         });
         return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '?gracias#gracias');
     }
 }
 public function finalizeTransaction(TierDescriptor $tiers, TransactionRepository $transactions, TransactionResultListener $resultListener)
 {
     $txId = Request::get("tx");
     // $st = Request::get('st');
     // $amt = Request::get('amt');
     $r = $this->callPayPalAPI($this->formUrl(), ["cmd" => "_notify-synch", "tx" => $txId, "at" => $this->pdtToken(), "submit" => "PDT"]);
     if ($r[0] == "SUCCESS") {
         $status = "success";
     } else {
         $status = $r[0];
     }
     $buyerId = Auth::user()->getAuthIdentifier();
     $money = $r['mc_gross'];
     $product = array_get($r, 'custom', 'free');
     $tierPrice = floatval($tiers->getTierPrice($product));
     if ($tierPrice > floatval($money)) {
         return $resultListener->transactionFail(null, sprintf(_("You did not pay the full amount of the price for the item! (For further information, the transaction id is %s)"), $txId));
     }
     $extra = json_encode($r);
     $tx = new PaypalTransaction($txId, $status, $buyerId, $money, $product, $extra);
     if ($tx->getStatus() == "success") {
         $transactions->saveOrUpdateTransaction($tx);
         return $resultListener->transactionOk($tx);
     } else {
         return $resultListener->transactionFail($tx, sprintf(_("The transaction did not commit. The current status is %s"), $tx->getStatus()));
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $params = Request::get('_form');
     $photo = "";
     $name = $params['name'];
     $surname = $params['surname'];
     $address = $params['address'];
     $photo = $params['image'];
     $contact = Contacts::find($id);
     $contact->name = $name;
     $contact->surname = $surname;
     $contact->address = $address;
     if ($photo != "") {
         $contact->photo = $photo;
     }
     //creo i numeri telefonici associati
     $numbers = $params['numbers'];
     $contact->numbers()->delete();
     foreach ($numbers as $number) {
         $new_number = Numbers::firstOrCreate(['number' => $number, 'contact_id' => $contact->id]);
         $contact->numbers()->save($new_number);
     }
     $contact->save();
     return response()->json(array('id' => $contact->id, 'name' => $contact->name, 'surname' => $contact->surname, 'photo' => $contact->photo));
 }
 public function showForumAction()
 {
     if (Request::has('id')) {
         if (!Request::has('page_number')) {
             $page_number = 1;
         } else {
             $page_number = Request::get('page_number');
         }
         $parent = Page::where('id', '=', Request::input('id'))->first();
         if ($parent->is_sheet) {
             $messages = ForumPageMessage::where('page_id', '=', $parent->id)->take(3)->skip(($page_number - 1) * 3)->get();
             $users = User::all();
             $page_title = $parent->title;
             $messages_count = ForumPageMessage::where('page_id', '=', $parent->id)->count();
             return view('base.forum_page', ['messages' => $messages, 'page_id' => Request::input('id'), 'users' => $users, 'page_title' => $page_title, 'page_number' => $page_number, 'messages_count' => $messages_count]);
         }
         $childs = Page::where('parent_id', '=', $parent->id)->get();
     } else {
         $parent = Page::where('title', '=', 'Форум')->first();
         $childs = Page::where('parent_id', '=', $parent->id)->get();
     }
     $child_messages = null;
     foreach ($childs as $child) {
         if ($child->is_sheet) {
             $child_messages[] = ForumPageMessage::where('page_id', '=', $child->id)->get();
         }
     }
     return view('base.forum', ['topics' => $childs, 'parent_page' => $parent, 'page_messages' => $child_messages]);
 }
 private function _captureReportFields()
 {
     $fields['report_level_id'] = Request::get('report_level_id');
     $fields['report_type_id'] = Request::get('report_type_id');
     switch ($fields['report_type_id']) {
         case ReportType::CUSTOM:
             $fields['view_mode'] = "days";
             $fields['format'] = "DD/MM/YYYY";
             $fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('d/m/Y');
             $fields['end_date'] = $this->_parseDate(Request::get('end_date'))->format('d/m/Y');
             break;
         case ReportType::YEARLY:
             $fields['view_mode'] = "years";
             $fields['format'] = "YYYY";
             $fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('Y');
             break;
         case ReportType::MONTHLY:
             $fields['view_mode'] = "months";
             $fields['format'] = "MM/YYYY";
             $fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('m/Y');
             break;
         case ReportType::DAILY:
         default:
             $fields['view_mode'] = "days";
             $fields['format'] = "DD/MM/YYYY";
             $fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('d/m/Y');
             break;
     }
     return $fields;
 }
 public function afterRegistered()
 {
     $this->response = lego_register(ResponseData::class, function () {
         $items = call_user_func_array($this->data(), [Request::get(self::KEYWORD_KEY), Request::all()]);
         return self::result($items);
     }, $this->name);
 }
Beispiel #13
0
 public function getPublications()
 {
     $post = Post::status(Request::get('filter'))->orderBy('updated_at', 'DESC')->paginate(20)->appends(Request::only(['filter']));
     $tmp = array('extends' => Config::get('social::social.tmp.admin', 'layout.base'), 'section_main' => Config::get('social::social.tmp.section_main', 'main'));
     $header_title = array('clase' => 'fa fa-share-alt', 'titulo' => 'Social <small>Publicaciones</small>');
     return View::make('social::listPublications', compact('post', 'tmp', 'header_title'));
 }
Beispiel #14
0
 /**
  * Shows the issues view.
  *
  * @return \Illuminate\View\View
  */
 public function indexAction()
 {
     $state = Request::get('state');
     // Issue & Issue Project list.
     $usedIssueProjects = Issue::where('project_id', '>', 0)->where('state', '=', $state)->groupBy('project_id')->lists('project_id');
     $issueProjects = Project::whereIn('id', $usedIssueProjects)->get();
     return View::make('dashboard.issues.index')->withIssueProjects($issueProjects)->withPageTitle(trans('dashboard.issues.issues') . ' - ' . trans('dashboard.dashboard'));
 }
 public function authenticate()
 {
     if (Auth::attempt(['email' => Request::get('email'), 'password' => Request::get('password')])) {
         return redirect()->intended('/');
     } else {
         return view('login', array('title' => 'Welcome', 'description' => '', 'page' => 'home'));
     }
 }
Beispiel #16
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $update = Blog::find($id);
     $update->title = Request::get('title');
     $update->blogpost = Request::get('blogpost');
     $update->save();
     return redirect('/admin/blog');
 }
 /**
  * Store a newly created resource in storage.
  * Validation error are in start/global.php
  *
  * @return Response
  */
 public function store()
 {
     $permission = new Permission();
     $permission->name = Request::get('name');
     $permission->description = Request::get('description');
     $permission->save();
     return redirect(route(config('larbac.routes.routePermission') . '.index'));
 }
Beispiel #18
0
 public function authenticate()
 {
     if (Auth::attempt(['email' => Request::get('email'), 'password' => Request::get('password')])) {
         return redirect()->intended('/')->with('message', 'Login Succesful');
     } else {
         return redirect()->intended('/')->with('message', 'Login Failed, Bad Username and/or Password Combination');
     }
 }
Beispiel #19
0
 private function getNeatnessDirection()
 {
     $direction = $this->neatness['default'][1];
     $request_direction = Request::get($this->_neatness_direction);
     if (in_array($request_direction, $this->_neatness_direction_values)) {
         $direction = $request_direction;
     }
     return $direction;
 }
 /**
  * Creates a new subscriber.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function createSubscriberAction()
 {
     try {
         $this->dispatch(new SubscribeSubscriberCommand(Request::get('email')));
     } catch (ValidationException $e) {
         return Redirect::route('dashboard.subscribers.add')->withInput(Request::all())->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.subscribers.add.failure')))->withErrors($e->getMessageBag());
     }
     return Redirect::route('dashboard.subscribers.add')->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.subscribers.add.success')));
 }
Beispiel #21
0
 /**
  * Updates a projects ordering.
  *
  * @return array
  */
 public function postUpdateProjectOrder()
 {
     $projectData = Request::get('ids');
     foreach ($projectData as $order => $projectId) {
         // Ordering should be 1-based, data comes in 0-based
         Project::find($projectId)->update(['order' => $order + 1]);
     }
     return $projectData;
 }
Beispiel #22
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     // find user
     $user = User::with('roles')->findOrFail($id);
     // get roles
     $roles = is_array(Request::get('roles')) ? Request::get('roles') : [];
     // asign roles
     $user->roles()->sync($roles);
     return redirect(route(config('larbac.routes.routeUser') . '.index'));
 }
Beispiel #23
0
 public function search()
 {
     $query = Request::get('q');
     if ($query) {
         $search = Search::where('foodName', 'LIKE', "%{$query}%")->get();
     } else {
         $search = Search::get();
     }
     return view('search')->with('search', $search);
 }
Beispiel #24
0
 private function getSmoothnessCondition($condition)
 {
     if (!isset($this->smoothness['condition']) || $this->smoothness['condition'] == 'auto') {
         $condition = Request::get('condition');
     }
     if (!in_array($condition, ['and', 'or'])) {
         $condition = 'and';
     }
     return $condition;
 }
Beispiel #25
0
 public function setReturnDateAttribute($value)
 {
     if ($value != '') {
         $this->attributes['return_date'] = date('Y-m-d', strtotime($value));
     }
     // jika beli
     if (Request::get('type') == 1) {
         $this->attributes['return_date'] = null;
     }
 }
Beispiel #26
0
 /**
  * get index 
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
 public function putResetpass()
 {
     $response = $this->call('/api/resetpass', 'put');
     $data = ['data' => !empty($response['content']['data']) ? $response['content']['data'] : '', 'label' => $this->label, 'url' => $this->url, 'view' => $this->view];
     if (method_exists($this, 'formApi')) {
         $data += $this->formApi();
     }
     $this->setflashSuccess($response);
     return $this->getShow(Request::get('id'));
 }
Beispiel #27
0
 /**
  * This method returns an array of fields parsed from the request. `[*]` is returned by default (all fields).
  * Fields can be written in snake_case or camelCase. They are converted to snake_case automatically.
  *
  * Example: `?fields=column1,column2` is returned as `['column1', 'column2']`
  *
  * @return array
  */
 protected function getFieldsFromRequest($prefix = null)
 {
     if (Request::has('fields')) {
         $prefix = $prefix ? $prefix . '.' : '';
         return array_map(function ($field) use($prefix) {
             return $prefix . snake_case($field);
         }, explode(',', Request::get('fields')));
     }
     return ['*'];
 }
Beispiel #28
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($user)
 {
     $limit = Request::get('limit') ?: 100;
     if (Auth::user()->id != $user->id && !$user->public && !Auth::user()->can('show-votes')) {
         //Not the current user, or public and not an admin
         abort(401, "You do not have permission to view this non-public user's votes");
     }
     $votes = Vote::where('user_id', $user->id)->active()->with('motion')->paginate($limit);
     return $votes;
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (urlRequest::has('setstatus')) {
         $setStatus = (int) urlRequest::get('setstatus');
         $member = Member::find($id);
         $member->status = $setStatus;
         $member->save();
         return redirect()->back();
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Article $article)
 {
     $sortBy = \Illuminate\Support\Facades\Request::get('sortBy');
     if ($sortBy == '') {
         $sortBy = 'published_at';
     }
     $order = \Illuminate\Support\Facades\Request::get('order');
     $articles = $this->postsRepo->getPaginated(compact('sortBy', 'order'));
     return view('dashboard.posts.posts', compact('articles', 'sortBy', 'order'));
 }