samedi 28 novembre 2015

Laravel 5.1 registration form with new field

I am creating referal system so..

    // Registration routes...
Route::get('auth/register/{id}', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

and my RegisterUser.php is changed to

public function getRegister($id)
{
    return view('auth.register')->withName($id);
}

and my blade look like

<div class="form-group">
    <label class="col-md-4 control-label">Company</label>
          <div class="col-md-6">
              <input type="text" class="form-control" name="company" value="{{ old('company') }}" readonly  disabled>
           </div>
</div>

in AuthController I have:

protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'company' => $data['company'],
        'password' => bcrypt($data['password']),
    ]);
}

and the value="{{ old('company') }}" is making the problem .... When is like that is working ... but I want the value to be value="{{$name}}" given from return view('auth.register')->withName($id); ..... so when i go to route auth/register/something in the input fuild I have got the 'something' so it is working but I have the error code "Undefined index: company". When I remove the value at all it is working but I need this value. Any suggestion will be helpfull. Thank you



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1OwBzD2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire