示例#1
0
 public function create(Request $request)
 {
     $user = new \App\User();
     $user->username = $request->username;
     $user->password = Hash::make($request->password);
     $user->email = $request->email;
     $user->firstname = $request->firstname;
     $user->middlename = $request->middlename;
     $user->lastname = $request->lastname;
     $user->permission()->associate(\App\Permission::find($request->permission_id));
     $user->save();
     $photo = new \App\Photo();
     $photo->path = 'default_user_thumbnail.png';
     $photo->user()->associate($user);
     $photo->save();
     return $user ? true : false;
 }