Skip to content

Instantly share code, notes, and snippets.

@corean
Last active September 4, 2017 10:09
Show Gist options
  • Select an option

  • Save corean/c71fbdf60acdcfe4a10439faa54cc047 to your computer and use it in GitHub Desktop.

Select an option

Save corean/c71fbdf60acdcfe4a10439faa54cc047 to your computer and use it in GitHub Desktop.
[Laravel] Laravel Eloquent ORM관련 #PHP #Laravel #ORM #Eloquent
//controller에서 패스워드를 인코딩할 필요없이 모델에서 적용
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
public function getPasswordAttribute($password)
{
return bcrypt($password);
}
//Retreive the name, email and password fields
$input = $request->only(['name', 'email', 'password']);
$user->fill($input)->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment