/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getCreate()
 {
     $permissions = $this->permission->all();
     $selectedPermissions = Input::old('permissions', array());
     $title = Lang::get('admin/roles/title.create_a_new_role');
     return View::make('admin/roles/create', compact('permissions', 'selectedPermissions', 'title'));
 }
Exemple #2
0
 public function update($view, $account)
 {
     $view->form(function ($view) use($account) {
         $view->page_header(function ($view) {
             $view->title('EDIT ACCOUNT');
         });
         // The response body is the Account
         $account = $account->get();
         // Get Roles and put it in a nice array for the dropdown
         $roles = array('' => '') + model_array_pluck(API::get(array('roles'))->get('results'), function ($role) {
             return $role->lang->name;
         }, 'id');
         // Get the Roles that belong to a User and put it in a nice array for the dropdown
         $active_roles = array();
         if (isset($account->roles)) {
             $active_roles = model_array_pluck($account->roles, 'id', '');
         }
         // Get Languages and put it in a nice array for the dropdown
         $languages = model_array_pluck(API::get(array('languages'))->get('results'), function ($language) {
             return $language->name;
         }, 'id');
         $view->text('name', __('admin::account.update.form.name'), Input::old('name', $account->name));
         $view->text('email', __('admin::account.update.form.email'), Input::old('email', $account->email));
         $view->password('password', __('admin::account.update.form.password'));
         $view->multiple('roles[]', __('admin::account.update.form.roles'), $roles, Input::old('roles', $active_roles));
         $view->dropdown('language_id', __('admin::account.update.form.language'), $languages, Input::old('language_id', $account->language->id));
         $view->actions(function ($view) {
             $view->submit(__('admin::account.update.buttons.edit'), 'primary');
         });
     }, 'PUT', prefix('admin') . 'account/' . $account->get('id') . '/edit');
 }
 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);
 }
Exemple #4
0
 public static function update($view, $id)
 {
     // Get the Account
     $response = API::get(array('account', $id));
     // Handle response codes other than 200 OK
     if (!$response->success) {
         return Event::first($response->code);
     }
     // The response body is the Account
     $account = $response->get();
     // Get Roles and put it in a nice array for the dropdown
     $roles = array('' => '') + model_array_pluck(API::get(array('role', 'all'))->get('results'), function ($role) {
         return $role->lang->name;
     }, 'id');
     // Get the Roles that belong to a User and put it in a nice array for the dropdown
     $active_roles = array();
     if (isset($account->roles)) {
         $active_roles = model_array_pluck($account->roles, 'id', '');
     }
     // Get Languages and put it in a nice array for the dropdown
     $languages = model_array_pluck(API::get(array('language', 'all'))->get('results'), function ($language) {
         return $language->name;
     }, 'id');
     $view->text('name', __('admin::account.update.form.name'), Input::old('name', $account->name));
     $view->text('email', __('admin::account.update.form.email'), Input::old('email', $account->email));
     $view->password('password', __('admin::account.update.form.password'));
     $view->multiple('roles[]', __('admin::account.update.form.roles'), $roles, Input::old('roles', $active_roles));
     $view->dropdown('language_id', __('admin::account.update.form.language'), $languages, Input::old('language_id', $account->language->id));
     $view->actions(function ($view) {
         $view->submit(__('admin::account.update.buttons.edit'), 'primary');
     });
 }
Exemple #5
0
 public static function inputOld($string)
 {
     if (static::isLaravel()) {
         return \Input::old($string);
     }
     return false;
 }
 /**
  * Show generate license form
  */
 public function getGenerateLicense()
 {
     $this->_data['page_title'] = "Generate License";
     $this->_data['affiliates'] = Affiliate::orderBy('name', 'ASC')->get();
     $this->_data['products'] = Product::orderBy('name', 'ASC')->get();
     $this->_data['plans'] = Plan::orderBy('name', 'ASC')->where('product_id', '=', Input::old('product_id'))->get();
     return View::make('admin.utilities.generate-license', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
 }
 public function __construct()
 {
     $errors = new MessageBag();
     if ($old = Input::old("errors")) {
         $errors = $old;
     }
     $this->errors = $errors;
 }
Exemple #8
0
function form_old($name, $default = null)
{
    if (Input::old($name) != null) {
        echo Input::old($name);
    } else {
        echo $default;
    }
}
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $promo = $this->promo;
     if (Input::old('img') != '') {
         $promo->img = Input::old('img');
     }
     return View::make('backend.promos.edit', compact('promo'));
 }
 /**
  * Group create.
  *
  * @return View
  */
 public function getCreate()
 {
     // Get all the available permissions
     $permissions = $this->permissions;
     // Selected permissions
     $selectedPermissions = Input::old('permissions', array());
     // Show the page
     return View::make('admin/groups/create', compact('permissions', 'selectedPermissions'));
 }
Exemple #11
0
/**
 * @param $model
 * @param $id
 * @return mixed
 */
function findOrCreate($model, $id)
{
    $obj = $model::find($id);
    $obj = $obj ?: new $model();
    foreach (Input::old() as $key => $old) {
        $obj->{$key} = $old ?: $obj->{$key};
    }
    return $obj;
}
 /**
  * Test the Input::old method.
  *
  * @group laravel
  */
 public function testOldInputCanBeRetrievedFromSession()
 {
     $this->setSession();
     Session::$instance->session['data']['laravel_old_input'] = array('name' => 'Taylor');
     $this->assertNull(Input::old('foo'));
     $this->assertTrue(Input::had('name'));
     $this->assertFalse(Input::had('foo'));
     $this->assertEquals('Taylor', Input::old('name'));
 }
Exemple #13
0
 public function getVolunteerMentors()
 {
     $city = \Input::old('volunteerMentorCity');
     if ($city === null) {
         $cities = $this->getVolunteerMentorCities();
         $city = $cities ? reset($cities) : null;
     }
     return $city ? VolunteerMentorQuery::create()->getVolunteerMentorByCity($city) : [];
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getCreate()
 {
     $roles = $this->role->all();
     $permissions = $this->permission->all();
     $selectedRoles = Input::old('roles', array());
     $selectedPermissions = Input::old('permissions', array());
     $mode = 'create';
     $title = Lang::get('admin/users/title.create_a_new_user');
     return Theme::make('admin/users/create_edit', compact('roles', 'permissions', 'selectedRoles', 'selectedPermissions', 'title', 'mode'));
 }
Exemple #15
0
 public function edit($role)
 {
     if (in_array(Input::old('name', $role->name), \Role::$protected) && Input::old('name', $role->name) != Input::get('name') || in_array(Input::get('name'), \Role::$protected) && Input::old('name', $role->name) != Input::get('name')) {
         return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
     }
     $inputs = Input::except('csrf_token');
     $save = $this->role->createOrUpdate($role->id, $this->permission->preparePermissionsForSave($inputs['permissions']));
     $errors = $save->errors();
     return count($errors->all()) == 0 ? Api::to(array('success', Lang::get('admin/roles/messages.update.success'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('success', Lang::get('admin/roles/messages.update.success')) : (Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->withErrors($errors));
 }
 /**
  * Lets us get a new instance populated with old input
  * if there is any input
  *
  * @return EloquentModel
  */
 public function newInstanceWithOldInput()
 {
     $instance = new static();
     foreach (\Input::old() as $key => $value) {
         if (\Schema::hasColumn($instance->getTable(), $key)) {
             $instance->{$key} = $value;
         }
     }
     return $instance;
 }
 /**
  * Displays the form for user creation
  *
  */
 public function create()
 {
     // Title
     $title = Lang::get('admin/user/title.create_a_new_user');
     // All roles
     $roles = $this->role->all();
     // Selected roles
     $selectedRoles = Input::old('roles', array());
     // Show the page
     return View::make('admin/user/create', compact('roles', 'selectedRoles', 'title'));
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     // Get all the available permissions
     $permissions = $this->permission->all();
     // Selected permissions
     $selectedPermissions = Input::old('permissions', array());
     // Title
     $title = Lang::get('admin/roles/title.create_a_new_role');
     // Show the page
     $this->render('admin/roles/create', compact('permissions', 'selectedPermissions', 'title'));
 }
Exemple #19
0
function setValue($value, $fieldname)
{
    $return = Input::old($fieldname);
    if ($value) {
        if (is_array($value) && array_key_exists('fromModel', $value)) {
            $return = Input::old($fieldname) ?: $value['fromModel']->{$fieldname};
        } else {
            $return = $value;
        }
    }
    return $return;
}
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getCreate()
 {
     $role = new Role();
     // Get all the available permissions
     $permissions = $this->permission->all();
     // Selected permissions
     $selectedPermissions = Input::old('permissions', array());
     // Title
     $title = Lang::get('admin/roles/title.create_a_new_role');
     // Show the page
     return View::make('admin/roles/edit', compact('role', 'permissions', 'selectedPermissions', 'title'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  string $permalink
  * @return Response
  */
 public function edit($full_permalink)
 {
     $category = Category::where('full_permalink', '=', $full_permalink)->firstOrFail();
     $template_options = Template::where('type', '=', '3')->get()->lists('name', 'id');
     $data = ['category' => $category, 'options' => \App::make('WorkInProgress\\Blog\\ArticleController')->getHierarchy(0, 0, 'blog::partials.option', \Input::old('blog_category_id') ?: $category->blog_category_id), 'template_options' => $template_options];
     //Grab the image URLs
     foreach ($this->image_labels as $key => $image_label) {
         $image = $category->images()->where('order', '=', $key + 1)->first();
         $data[$image_label] = $image ? $image->src : null;
     }
     return \View::make('blog::category.edit', $data);
 }
 public function edit($role)
 {
     if (in_array(Input::old('name', $role->name), $this->protected_roles) && Input::old('name', $role->name) != Input::get('name') || in_array(Input::get('name'), $this->protected_roles) && Input::old('name', $role->name) != Input::get('name')) {
         return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
     }
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->passes()) {
         $inputs = Input::except('csrf_token');
         return $this->role->createOrUpdate($role->id, $this->permission->preparePermissionsForSave($inputs['permissions'])) ? Api::to(array('success', Lang::get('admin/roles/messages.update.success'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('success', Lang::get('admin/roles/messages.update.success')) : Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
     }
     return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->withInput()->withErrors($validator);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $post = $this->post;
     if (Input::old('image') != '') {
         $post->avatar = Input::old('image');
     }
     /* if (!empty($request->input("category_id"))) {
             $post->category_id = $request->input("category_id");
             }
     
             $catalog = $Catalog->getDocumentTree(); */
     return View::make('backend.blog.posts.edit', compact('post'));
 }
 /**
  * User create.
  *
  * @return View
  */
 public function getCreate()
 {
     // Get all the available groups
     $groups = Sentry::getGroupProvider()->findAll();
     // Get all the available permissions
     $permissions = $this->permissions;
     // Selected groups
     $selectedGroups = Input::old('groups', array());
     // Selected permissions
     $selectedPermissions = Input::old('permissions', array());
     // Show the page
     return View::make('admin/users/create', compact('groups', 'permissions', 'selectedGroups', 'selectedPermissions'));
 }
 /**
  * @param $params
  * @return string
  */
 public static function getField($params)
 {
     $text = $params['text'] ? $params['text'] : 'Select File';
     $class = $params['class'] ? $params['class'] : 'btn btn-default';
     $field_name = isset($params['field_name']) ? $params['field_name'] : 'image';
     $default = isset($params['default']) ? $params['default'] : \Input::old($params['field_name']);
     if (!empty($default)) {
         $image = '<img src="' . route('showthumb', $default) . '" class="imageManagerImage" />';
     } else {
         $image = '<img src="" style="display:none" class="imageManagerImage" />';
     }
     return '<div class="ImageManager">' . $image . '<br /><br />' . '<button class="fileManager ' . $class . '" type="Button" data-url="' . route('ImageManager') . '" data-multi="false">' . $text . '</button>' . \Form::hidden($field_name, $default, ['class' => 'inputFile']) . '</div>';
 }
Exemple #26
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $user = new User();
     $user->username = Input::get('username');
     $user->password = Hash::make(Input::old('password'));
     $user->email = Input::get('email');
     $user->firstname = Input::get('firstname');
     $user->lastname = Input::get('lastname');
     $user->gender = Input::get('gender');
     $user->about = Input::get('about');
     $user->save();
     return Redirect::to('/');
 }
 public function createCustomRecord($parameters)
 {
     $parameters['territorialAreas1'] = TerritorialArea1::getTerritorialAreas1FromCountry($parameters['country']);
     if ($this->request->old('territorialArea1') && $this->request->old('territorialArea1') != "null") {
         $parameters['territorialAreas2'] = territorialArea1::find(Input::old('territorialArea1'))->getTerritorialAreas2;
     } else {
         $parameters['territorialAreas2'] = [];
     }
     $parameters['country'] = Country::where('id_002', $parameters['country'])->where('lang_id_002', base_lang()->id_001)->first();
     $parameters['customTrans'] = $parameters['country']->territorial_area_3_002;
     $parameters['customTransHeader'] = $parameters['country']->territorial_area_3_002 . ' (' . $parameters['country']->name_002 . ')';
     return $parameters;
 }
Exemple #28
0
 public function get_reset($hash64 = null)
 {
     if (is_null($hash64)) {
         if (Input::had('hash64')) {
             $hash64 = Input::old('hash64');
         } else {
             return Response::error('404');
         }
     }
     if (!($user = User::Find_Hash($hash64))) {
         return Response::error('404');
     }
     return View::make('user.reset_password')->with('hash64', $hash64);
 }
 public function create($clientPublicId = 0)
 {
     if (!Utils::isPro()) {
         return Redirect::to('/invoices/create');
     }
     $client = null;
     $invoiceNumber = Auth::user()->account->getNextInvoiceNumber();
     $account = Account::with('country')->findOrFail(Auth::user()->account_id);
     if ($clientPublicId) {
         $client = Client::scope($clientPublicId)->firstOrFail();
     }
     $data = array('account' => $account, 'invoice' => null, 'data' => Input::old('data'), 'invoiceNumber' => $invoiceNumber, 'method' => 'POST', 'url' => 'invoices', 'title' => trans('texts.new_quote'), 'client' => $client);
     $data = array_merge($data, self::getViewModel());
     return View::make('invoices.edit', $data);
 }
Exemple #30
0
 /**
  * Execute the helper
  * {{input 'fieldname'}}
  * {{input 'fieldname' default}}
  *
  * @param \Handlebars\Template $template The template instance
  * @param \Handlebars\Context  $context  The current context
  * @param array                $args     The arguments passed the the helper
  * @param string               $source   The source
  *
  * @return mixed
  */
 public function execute(Template $template, Context $context, $args, $source)
 {
     $args = $template->parseArguments($args);
     $countAgrs = count($args);
     if ($countAgrs == 0) {
         return '';
     }
     if (!$args[0] instanceof \Handlebars\String) {
         return '';
     }
     $old = \Input::old($args[0]->getString(), false);
     if ($old) {
         return $old;
     }
     return \Input::get($args[0]->getString(), $context->get($args[0]->getString()));
 }