i am trying to implement update profile functionality, here's the form which is saving the data form
and here's the controller which is supposed to be saving image to the path controller
there is relation in photo and user which is in the user class.
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'firstName', 'lastName','userName' ,'email', 'password','photo_id',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function photo(){
return $this->belongsTo('App\Photo');
}
and here are the request files.
public function rules()
{
return [
'firstName'=> 'required',
'lastName' => 'required',
'userName' => 'required',
'photo_id' => 'required',
'email' => 'required',
];
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire