I need to register a new user and store data in two tables separately, the Users table will hold classic id /name / email / password information while the doctor table will hold different information related to the new registered user, for example gender, age, user_pic etc. I also need to edit the user info & save the value in two tables.How can I achieve this.Thanks. My route file is
Route::group([
'middleware' => 'auth'
], function() {
Route::get('/home', [
'as' => 'admin',
'uses' => 'AdminController@index'
]);
Route::get('/profile', array('as' =>'profile' ,'uses' => 'ProfileController@index'));
// Route::get('/profile/{profile_id}',[
// 'as' => 'profile',
// 'uses' => 'ProfileController@index'
// ]);
Route::get('/mail',[
'as' => 'mail',
'uses' => 'MailController@index'
]);
});
My Doctor Model is
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Doctor extends Model
{
protected $fillable = [
'name',
'division_id',
'district_id',
];
public function district()
{
return $this->belongsto('App\District');
}
public function division()
{
return $this->belongsto('App\Division');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire