4
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 been made, should be the update action of my controller that is not right follows 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 the one dd($request->all());
returns 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"
]
Already quado do um dd($corretor);
returns only these 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"
Ai Bruno the answer of the companion solved his problem?
– novic