public function update($id) { $personne = Personne::complet()->find($id); $personne->prenom = Input::get('prenom'); $personne->nom = Input::get('nom'); // $personne->pseudo = Input::get('pseudo'); // var_dump($personne->relations->toArray()); // dd($personne->qualites->toArray()); var_dump(Input::all()); var_dump($personne->qualites->toArray()); \DB::transaction(function () use($personne) { if (Input::get('adresse')) { $personne->adresses()->sync(Input::get('adresse')); } if (Input::get('qualite')) { var_dump($personne->qualites()->sync(Input::get('qualite'))); } var_dump($personne->qualites()->sync(Input::get('relation'))); foreach (Input::get('relation') as $key => $value) { } if (Input::get('telephone')) { $personne->telephones()->sync(Input::get('telephone')); } if (Input::get('mail')) { $personne->mails()->sync(Input::get('mail')); } var_dump($personne->qualites->toArray()); dd('stop save'); $personne->save(); $personne->push(); }); // $personne = Personne::complet()->find($id); // dd($personne->toArray()); }
Route::get('/', 'WelcomeController@index'); Route::get('home', 'HomeController@index'); Route::get('/imap/free/{util}', 'Imap\\ImapController@free'); Route::get('/imap', 'Imap\\ImapController@index'); Route::resource('adresse', 'AdresseController'); Route::resource('adherent', 'AdherentController'); Route::resource('personne', 'PersonneController'); Route::resource('structure', 'StructureController'); Route::resource('article', 'ArticleController'); Route::get('adhesion/create/{type}', ['as' => 'adhesion.create', 'uses' => 'AdhesionController@create']); Route::resource('adhesion', 'AdhesionController', ['except' => array('create')]); Route::get('ck', function () { return View::make('ck'); }); Route::get('ad', function () { $test = Personne::with('adresses')->find(10); return var_dump($test->toArray()); return var_dump($test); }); Route::get('able', function () { $test = Coordonnable::with('mails', 'telephones')->get(); return var_dump($test->toArray()); return var_dump($test); // return var_dump($test[0]->personne); }); // Route::get('able', function(){ // $test = Coordonnable::whereHas('personne', function($query){ // $query->where('personnes.id', 'like', 7); // })->toSql(); // return var_dump($test); // // return var_dump($test[0]->personne);
public function update($id, $input) { // dd($input->all()); $personne = Personne::find($id); // dd($input->get('adresse')); //AfA prévoir transaction $personne->adresses()->sync(array($input->get('adresse'))); $personne->coordonnees()->sync(array($input->get('coordonnees'))); $personne->qualites()->sync(array($input->get('qualite'))); $personne->structures()->sync(array($input->get('structure'))); $personne->nom = Input::get('nom'); // $personne->theme_id = Input::get('theme_id'); // $type = Input::get('livrable'); // $personne->livrable_type = $type; // $personne->livrable_id = ($type == 'Lib\Editeurs\Editeur') ? Input::get('editeur_id') : Input::get('autoedite_id'); $personne->save(); }