Exemplo n.º 1
1
 public function checkPaginate($keepQuery = null)
 {
     $flag = true;
     $request = Request::get($this->getPageName());
     $cPage = $this->currentPage();
     if ($this->isEmpty() && 1 != $cPage || 1 == $cPage && !is_null($request) && (int) $request != $cPage) {
         if (is_null($keepQuery)) {
             $keepQuery = $this->getKeepQuery();
         }
         if ($keepQuery) {
             $query = array_except(Request::query(), $this->getPageName());
             $this->appends($query);
         }
         $action = $this->getActionOnError();
         switch ($action) {
             case 'abort':
                 App::abort(404);
                 break;
             case 'first':
                 $flag = Redirect::to($this->url(0), $this->getErrorStatus());
                 break;
             case 'out':
                 $url = 1 == $this->currentPage() ? 0 : $this->lastPage();
                 $flag = Redirect::to($this->url($url), $this->getErrorStatus());
                 break;
             default:
                 throw new PageNotFoundException();
         }
     }
     return $flag;
 }
Exemplo n.º 2
0
 /**
  * @param $classNames
  * @return array
  */
 private function extractCalendarClassNames($classNames)
 {
     if (is_string($classNames)) {
         $classNames = explode(" ", $classNames);
     }
     return array_flip(array_except(array_flip($classNames), ['ui', 'calendar', 'event']));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Forum $forum, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $forum->update($input);
     return Redirect::route('Forum.show', $forum->id)->with('message', 'Forum updated.');
 }
Exemplo n.º 4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $pay = Paygrade::findOrFail($id);
     $input = array_except(Input::all(), '_method');
     $pay->update($input);
     return Redirect::route('admin.setup.job.paygrades.index')->withFlashSuccess('Pay grades data was successfully edited.');
 }
Exemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Project $project, Task $task)
 {
     // return view('tasks/index',compact('project'));
     $input = array_except(Input::all(), '_method');
     $task->update($input);
     return Redirect::route('projects.tasks.show', [$project->slug, $task->slug])->with('message', 'Task updated.');
 }
Exemplo n.º 6
0
 /**
  * Outputs <link> and <script> tags to load assets previously added with addJs and addCss method calls
  * @param string $type Return an asset collection of a given type (css, rss, js) or null for all.
  * @return string
  */
 public function makeAssets($type = null)
 {
     if ($type != null) {
         $type = strtolower($type);
     }
     $result = null;
     $reserved = ['build'];
     if ($type == null || $type == 'css') {
         foreach ($this->assets['css'] as $asset) {
             $attributes = HTML::attributes(array_merge(['rel' => 'stylesheet', 'href' => $this->getAssetEntryBuildPath($asset)], array_except($asset['attributes'], $reserved)));
             $result .= '<link' . $attributes . '>' . PHP_EOL;
         }
     }
     if ($type == null || $type == 'rss') {
         foreach ($this->assets['rss'] as $asset) {
             $attributes = HTML::attributes(array_merge(['rel' => 'alternate', 'href' => $this->getAssetEntryBuildPath($asset), 'title' => 'RSS', 'type' => 'application/rss+xml'], array_except($asset['attributes'], $reserved)));
             $result .= '<link' . $attributes . '>' . PHP_EOL;
         }
     }
     if ($type == null || $type == 'js') {
         foreach ($this->assets['js'] as $asset) {
             $attributes = HTML::attributes(array_merge(['src' => $this->getAssetEntryBuildPath($asset)], array_except($asset['attributes'], $reserved)));
             $result .= '<script' . $attributes . '></script>' . PHP_EOL;
         }
     }
     return $result;
 }
Exemplo n.º 7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Project $project
  * @return Response
  */
 public function update(User $user)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $user->update($input);
     return Redirect::route('users.show', $user->name)->with('message', 'User updated.');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  License $license
  * @return Response
  */
 public function update(License $license, Request $request)
 {
     $input = array_except($request->all(), ['_method', '_token']);
     $license->update($input);
     Cache::flush();
     return redirect()->route('licenses.show', $license->id)->with('message', 'License updated.')->with('message-class', 'success');
 }
 public function open(array $options = [])
 {
     $method = array_get($options, 'method', 'post');
     if ($this->formConfig == []) {
         $this->loadConfig();
     }
     $this->opened = true;
     $options = $this->appendClassToOptions($this->formConfig['class'], $options);
     // We need to extract the proper method from the attributes. If the method is
     // something other than GET or POST we'll use POST since we will spoof the
     // actual method since forms don't support the reserved methods in HTML.
     $attributes['method'] = $this->getMethod($method);
     $attributes['action'] = $this->getAction($options);
     $attributes['accept-charset'] = 'UTF-8';
     // If the method is PUT, PATCH or DELETE we will need to add a spoofer hidden
     // field that will instruct the Symfony request to pretend the method is a
     // different method than it actually is, for convenience from the forms.
     $append = $this->getAppendage($method);
     if (isset($options['files']) && $options['files']) {
         $options['enctype'] = 'multipart/form-data';
     }
     // Finally we're ready to create the final form HTML field. We will attribute
     // format the array of attributes. We will also add on the appendage which
     // is used to spoof requests for this PUT, PATCH, etc. methods on forms.
     $attributes = array_merge($attributes, array_except($options, $this->reserved));
     // Finally, we will concatenate all of the attributes into a single string so
     // we can build out the final form open statement. We'll also append on an
     // extra value for the hidden _method field if it's needed for the form.
     $attributes = $this->html->attributes($attributes);
     return '<form' . $attributes . '>' . $append;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  Project $project
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Project $project)
 {
     $input = array_except(Input::all(), '_method');
     $project->update($input);
     Session::flash('flash_message', 'Project updated successfully!');
     return Redirect::route('projects.index')->with('message', 'Project created');
 }
Exemplo n.º 11
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $comp = CompanyStructure::findOrFail($id);
     $input = array_except(Input::all(), '_method');
     $comp->update($input);
     return Redirect::route('admin.setup.company.structures.index')->withFlashSuccess('Company structure data was successfully edited.');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  * @param  int  $id
  * @return Response
  */
 public function update(Project $project, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $project->update($input);
     return Redirect::route('project.index', $project->slug)->with('message', 'Project updated.');
 }
Exemplo n.º 13
0
 /**
  * Serve authorization page
  * @param  Authorizer $authorizer
  * @return View response
  */
 public function getAuthorization(Authorizer $authorizer)
 {
     $authParams = $authorizer->getAuthCodeRequestParams();
     $formParams = array_except($authParams, 'client');
     $formParams['client_id'] = $authParams['client']->getId();
     return view('auth.pages.authorization', ['params' => $formParams, 'client' => $authParams['client']]);
 }
Exemplo n.º 14
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Project $project
  * @param  \App\Task    $task
  * @param \Illuminate\Http\Request $request 
  * @return Response
  */
 public function update(Project $project, Task $task, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $task->update($input);
     return Redirect::route('projects.tasks.show', [$project->slug, $task->slug])->with('message', 'Task updated.');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Repair $repair, Request $request)
 {
     $input = array_except(Input::all(), ['_method']);
     $this->validate($request, ['LicencePlate' => ['required', 'exists:cars', 'regex:/\\b([A-Z]{3}\\s?(\\d{3}|\\d{2}|d{1})\\s?[A-Z])|([A-Z]\\s?(\\d{3}|\\d{2}|\\d{1})\\s?[A-Z]{3})|(([A-HK-PRSVWY][A-HJ-PR-Y])\\s?([0][2-9]|[1-9][0-9])\\s?[A-HJ-PR-Z]{3})\\b/'], 'StaffId' => 'required|exists:staff,Id', 'Ongoing' => 'boolean', 'Type' => 'required', 'StartDate' => 'required|date', 'EndDate' => 'required|date|after:StartDate', 'Cost' => 'required|numeric|min:0', 'Paid' => 'boolean']);
     $repair->update($input);
     return Redirect::route('repairs.index')->with('message', 'Repair updated');
 }
Exemplo n.º 16
0
 public function startServer($server_name)
 {
     $pidfile = $this->getPidFile();
     if ($pidfile) {
         $pid = file_get_contents($pidfile);
         if ($pid && posix_kill($pid, 0)) {
             throw new Exception("Server already started", 15);
         }
     }
     $config = config('swoole.servers.' . $server_name);
     if (empty($config)) {
         throw new Exception("No configure for {$server_name}");
     }
     $server_type = array_get($config, 'server_type', 'HttpServer');
     try {
         $serv = app(sprintf('Pauldo\\Lswoole\\Services\\Swoole\\%s', $server_type), ['ip' => $config['ip'], 'port' => $config['port']]);
     } catch (\Exception $e) {
         throw new Exception($e->getMessage(), $e->getCode());
     }
     if (empty($serv)) {
         throw new Exception("Create server faild!");
     }
     $this->server = $serv;
     $set_arr = array_except($config, ['ip', 'port', 'server_type']);
     $serv->set($set_arr);
     $this->bindEvents();
     $serv->bindEvents();
     $serv->start();
     return $serv;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  Project $project
  * @return Response
  */
 public function update(Request $request, Project $project)
 {
     //
     $input = array_except(Input::all(), '_method');
     $project->update($input);
     return Redirect::route('projects.show', $project->slug)->with('message', 'Project updated.');
 }
Exemplo n.º 18
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Fileentry $entry)
 {
     if ($entry['type'] != 'image' && $entry['type'] != 'video') {
         $entry = array_except($entry, array("link"));
     }
     return $entry->toJson();
 }
Exemplo n.º 19
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $edu = Education::findOrFail($id);
     $input = array_except(Input::All(), '_method');
     $edu->update($input);
     return Redirect::route('admin.setup.qualification.educations.index')->withFlashSuccess('Education data was successfully edited.');
 }
Exemplo n.º 20
0
 public function testCanCreateSingleTextWithoutLabel()
 {
     $input = $this->former->text('foo')->label(null)->__toString();
     $matchField = array_except($this->matchField(), 'id');
     $this->assertHTML($this->matchControlGroup(), $input);
     $this->assertHTML($matchField, $input);
 }
Exemplo n.º 21
0
 public function __construct(Model $model, $base = 'tag')
 {
     parent::__construct($model, $base);
     $this->breadcrumb2Icon = 'tag';
     $this->fields = array_except($this->model->getFields(), ['id']);
     $this->view->share();
 }
Exemplo n.º 22
0
 public function loadAttributes()
 {
     $attributes = array_except($this->getProperties(), ['user']);
     /*
      * Convert booleans
      */
     array_walk($attributes, function (&$value, $key) {
         switch ($value) {
             case '1':
                 $value = 'true';
                 break;
             case '0':
                 $value = 'false';
                 break;
             default:
                 $value = $value;
                 break;
         }
     });
     /*
      * Prefix attributes with data-
      */
     $prefixAttributes = [];
     foreach ($attributes as $key => $value) {
         $prefixAttributes['data-' . $key] = $value;
     }
     return HTML::attributes($prefixAttributes);
 }
 public function create($data, $content_page_id)
 {
     $i = 0;
     foreach (array_except($data, ['_token', 'template', 'name', 'field']) as $key => $field) {
         $field_size = count(json_decode($field, true));
         if ($field_size > 0) {
             try {
                 $content_page_field = $this->model->create(['content_page_id' => $content_page_id, 'field' => $key]);
             } catch (\Exception $e) {
                 return false;
             }
         }
         if ($field_size > 0) {
             foreach (json_decode($field, true) as $field) {
                 $fields[$i][] = $field + ['content_page_field_id' => $content_page_field->id];
                 try {
                     $content_page_field->fieldsDetails()->attach([$field + ['content_page_field_id' => $content_page_field->id]]);
                 } catch (\Exception $e) {
                     return false;
                 }
             }
         }
         $i++;
     }
     return true;
 }
Exemplo n.º 24
0
 /**
  * Nest items
  *
  * @return mixed boolean|NestableCollection
  */
 public function nest()
 {
     $parentKey = $this->parentKey;
     if (!$parentKey) {
         return $this;
     }
     // Set id as keys
     $this->items = $this->getDictionary();
     $keysToDelete = array();
     // add empty children collection.
     $this->each(function ($item) {
         if (!$item->items) {
             $item->items = App::make('Illuminate\\Support\\Collection');
         }
     });
     // add items to children collection
     foreach ($this->items as $key => $item) {
         if ($item->{$parentKey} && isset($this->items[$item->{$parentKey}])) {
             $this->items[$item->{$parentKey}]->items->push($item);
             $keysToDelete[] = $item->id;
         }
     }
     // Delete moved items
     $this->items = array_values(array_except($this->items, $keysToDelete));
     return $this;
 }
 public static function addBeforeFilter($controller, $method, $args)
 {
     $method = last(explode('::', $method));
     $resourceName = array_key_exists(0, $args) ? snake_case(array_shift($args)) : null;
     $lastArg = last($args);
     if (is_array($lastArg)) {
         $args = array_merge($args, array_extract_options($lastArg));
     }
     $options = array_extract_options($args);
     if (array_key_exists('prepend', $options) && $options['prepend'] === true) {
         $beforeFilterMethod = "prependBeforeFilter";
         unset($options['prepend']);
     } else {
         $beforeFilterMethod = "beforeFilter";
     }
     $resourceOptions = array_except($options, ['only', 'except']);
     $filterPrefix = "router.filter: ";
     $filterName = "controller." . $method . "." . get_classname($controller) . "(" . md5(json_encode($args)) . ")";
     $router = App::make('router');
     if (!Event::hasListeners($filterPrefix . $filterName)) {
         $router->filter($filterName, function () use($controller, $method, $resourceOptions, $resourceName) {
             $controllerResource = App::make('Efficiently\\AuthorityController\\ControllerResource', [$controller, $resourceName, $resourceOptions]);
             $controllerResource->{$method}();
         });
         call_user_func_array([$controller, $beforeFilterMethod], [$filterName, array_only($options, ['only', 'except'])]);
     }
 }
Exemplo n.º 26
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $linkObj = Links::whereId($id)->get()->first();
     $input = array_except(Input::all(), '_method');
     $linkObj->update($input);
     return Redirect::route('links.edit', $id)->with('message', 'Link updated.');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Entity $entity, Request $request)
 {
     $input = array_except($request->all(), ['_method', '_token']);
     $entity->update($input);
     Cache::flush();
     return redirect()->route('entities.show', $entity->id)->with('message', 'Entity updated.');
 }
Exemplo n.º 28
0
 /**
  * To sort item of page.
  * @return   View
  */
 public function getSort(Request $request)
 {
     $this->repo->grabAllLists();
     $model = $this->repo->makeQuery();
     $sortable = true;
     if ($this->repo->isSortFilterFormConfigExists()) {
         $sortable = false;
         if ($request->has('filter')) {
             $sortable = true;
             $filter = array_except($request->query(), $this->filterExcept);
             foreach ($filter as $item) {
                 if (!$item) {
                     $sortable = false;
                 }
             }
             $model = $this->repo->filter($filter, $model);
         }
         view()->share('beforeSortShouldFilter', !$sortable);
         view()->share('filterForm', Formaker::setModel($this->repo->getModel())->make($request->all()));
     }
     $limit = $request->input('perPage', $this->paginationCount);
     $items = $this->repo->showByPage($limit, $request->query(), $model->with($this->relations));
     $data = ['paginationCount' => $limit, 'sortable' => $sortable, 'rules' => $this->functionRules];
     $lister = Lister::make($items, $this->listConfig, $data);
     event('controllerAfterAction', ['']);
     return $this->layout()->with('listEmpty', $items->isEmpty())->with('sortable', $sortable)->with('lister', $lister);
 }
Exemplo n.º 29
-1
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Car $car, Request $request)
 {
     $input = array_except(Input::all(), ['_method']);
     $this->validate($request, ['LicencePlate' => ['required', 'unique:cars,LicencePlate,' . $car->LicencePlate . ',LicencePlate', 'regex:/\\b([A-Z]{3}\\s?(\\d{3}|\\d{2}|d{1})\\s?[A-Z])|([A-Z]\\s?(\\d{3}|\\d{2}|\\d{1})\\s?[A-Z]{3})|(([A-HK-PRSVWY][A-HJ-PR-Y])\\s?([0][2-9]|[1-9][0-9])\\s?[A-HJ-PR-Z]{3})\\b/'], 'ClientId' => ['required', 'exists:clients,Id']]);
     $car->update($input);
     return Redirect::route('cars.index')->with('message', 'Car updated');
 }
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $app = $this->app;
     if (!env('LEHTER_DSN')) {
         return;
     }
     $this->app['raven.client'] = $this->app->share(function ($app) {
         $config['dsn'] = env('LEHTER_DSN');
         $config['level'] = env('LEHTER_LEVEL');
         $config['curl_method'] = env('LEHTER_CURL_METHOD');
         $dsn = env('LEHTER_DSN');
         if (!$dsn) {
             throw new InvalidArgumentException('Lehter DSN not configured');
         }
         // Use async by default.
         if (empty($config['curl_method'])) {
             $config['curl_method'] = 'async';
         }
         return new LehterClient($dsn, array_except($config, ['dsn']));
     });
     //dd($this->app['raven.client']);
     $this->app['raven.handler'] = $this->app->share(function ($app) {
         $level = env('LEHTER_LEVEL');
         return new LehterLogHandler($app['raven.client'], $app, $level);
     });
     if (isset($this->app['log'])) {
         $this->registerListener();
     }
     // Register the fatal error handler.
     register_shutdown_function(function () use($app) {
         if (isset($app['raven.client'])) {
             (new Raven_ErrorHandler($app['raven.client']))->registerShutdownFunction();
         }
     });
 }