I'm trying to do an update and three tables related to Laravel, the past data comes from a single view, and the relationships have already been made, it should be the action update of my controller that is not right below.
Update of CorretoresControllers
public function update(Corretor $corretor, Request $request) {
$corretor->update($request->all());
return redirect('corretores');
}
Model Corretor
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Endereco;
use App\Contato;
use App\Documento;
class Corretor extends Model {
protected $fillable = ['nome', 'email'];
protected $table = 'corretors';
public function endereco() {
return $this->hasMany('App\Endereco');
}
public function contato() {
return $this->hasMany('App\Contato');
}
public function documento(){
return $this->hasMany('App\Documento');
}
}
When a dd($request->all());
returns me the following data:
array:11 [▼
"_method" => "PUT"
"_token" => "sWlp1StEgwx7PXZbjo7nV8eYecKpic32E21YeWxA"
"nome" => "Bruno Neves 1"
"email" => "[email protected]"
"logradouro" => "TV DO PARAISO 214"
"numero" => "10"
"telefone" => "9632242778"
"celular1" => "9999-9999"
"celular2" => "9999-9999"
"cpf" => "123"
"rg" => "123"
]
Since a dd($corretor);
already returns only this data:
"id" => "13"
"nome" => "Bruno Santos"
"email" => "[email protected]"
"created_at" => "2016-01-26 00:55:11"
"updated_at" => "2016-02-04 03:14:27"