Controller
public function cadastro()
{
return View('/cadastro');
}
public function novo()
{
$user = \App\User::where('User',"=", Input::get("User"))->first();
$user->name = Input::get('name');
$user->host = Input::get('host');
$user->login = Input::get('login');
$user->password = hash('sha256', Input::get('password'));
$user->save($user);
}
Routes
Route::get('cadastro', 'Auth\RegisterController@cadastro');
Route::post('cadastro', 'Auth\RegisterController@novo');
View
<body>
<section method="POST" action="cadastro/novo">
<nav class="navbar navbar-default navbar-static-top">
<h1><b>CADASTRE SUA EMPRESA!</b></h1>
<hr>
</nav>
<div id="area">
<form id="formulario">
<fieldset style = "width: 200%; margin: 0px auto;">
<img src="/imagens/cliente.png" width="60px" height="60px" required/>
<input type="text" name="name" class="name" placeholder="Nome:" required><br>
<input type="text" name="host" class="host" placeholder="Host:" required><br>
<input type="text" name="email" class="email" placeholder="Email:" required><br>
<input type="password" name="password" class="senha" placeholder="Senha:" required>
<legend><input type="submit" value="Cadastrar" onclick="return change(this);"/></legend>
</fieldset>
</form>
</div>
</section>
<img class="canto" src="/imagens/unius.png"/>
<footer>
<p>Desenvolvido por: Vitória</p>
</footer>
Model User
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $fillable = [
'name', 'email','password','tipo'
];
protected $hidden = [
'password', 'remember_token', 'tipo'
];
public function clients ()
{
return $this->belongsToMany('App\client', 'client_user');
}
class clientUser extends Model
{
public $timestamps = false;
}
}
Customers table: This is my clients table, which is where I'm having difficulty, because the form is not saving on it.
Users table: Where are my users.
ClientUser table: Where does the relationship of the two tables ... Who is the admin user selects which clients the developer users can see.
Viewofregister!