本文整理汇总了PHP中app\Profile::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::save方法的具体用法?PHP Profile::save怎么用?PHP Profile::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Profile
的用法示例。
在下文中一共展示了Profile::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(CreateUserRequest $request)
{
$id = Auth::user()->id;
if ($request->file('photo')) {
$file = $request->file('photo');
$name = 'Appmm_' . time() . '.' . $file->getClientOriginalExtension();
// $path = public_path().'/upload/users/';
// $file->move($path,$name);
Storage::disk('users')->put($name, \File::get($file));
}
$users = new User($request->all());
$users->iduser_create = $id;
$users->photo = $name;
$users->save();
$profiles = new Profile();
$profiles->user_id = $users->id;
$profiles->save();
Session::flash('message', 'El usuario ' . $users->name . ' Fue creado exitosamente');
//guarda el valor de los campos enviados desde el form en un array
$data = $request->all();
//se envia el array y la vista lo recibe en llaves individuales {{ $email }} , {{ $subject }}...
\Mail::send('emails.message', $data, function ($message) use($request) {
//remitente
$message->from($request->email, $request->name);
//asunto
$message->subject($request->name);
//receptor
$message->to(env('CONTACT_MAIL'), env('CONTACT_NAME'));
});
return redirect()->route('admin.usuarios.index');
}
示例2: store
public function store(Request $request)
{
//dd($request);
try {
if (!($user = JWTAuth::parseToken()->authenticate())) {
return response()->json(['user_not_found'], 404);
}
} catch (Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
return response()->json(['token_expired'], $e->getStatusCode());
} catch (Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
return response()->json(['token_invalid'], $e->getStatusCode());
} catch (Tymon\JWTAuth\Exceptions\JWTException $e) {
return response()->json(['token_absent'], $e->getStatusCode());
}
// the token is valid and we have found the user
//dd($request->all());
try {
$id = $user->profile->user_id;
return response()->json(['Profile already exists'], 409);
} catch (\Exception $e) {
$profile = new Profile();
$profile->user_id = $user->id;
$profile->name = $request->input('name');
$profile->phone_no = $request->input('phone_no');
$profile->birthdate = $request->input('birthdate');
$profile->experience = $request->input('experience');
$profile->industry_id = $request->input('spec_id');
$profile->save();
//return response()->json($profile->id);
return response()->json(['success profile' . $profile->id], 200);
}
}
示例3: postAdd
public function postAdd(UserRequest $request)
{
if ($request->sltRole > 2) {
return redirect()->back()->with('danger', 'Dont try to be a hacker!!!');
}
$model = new User();
$model->email = $request->txtEmail;
$model->password = Hash::make($request->txtPass);
$model->name = $request->txtName;
$model->role_id = $request->sltRole;
$model->level_id = $request->rdbLevel;
$model->phone = $request->txtPhone;
$model->birthday = $request->txtBirth;
$model->department_id = $request->sltDepartment;
$model->save();
$profile = new Profile();
$profile->user_id = $model->id;
if ($profile->save()) {
$data = ['name' => Request::input('txtName'), 'password' => Request::input('txtPass'), 'email' => Request::input('txtEmail')];
Mail::send('emails.blanks', $data, function ($message) {
$message->from('trongtri0705@gmail.com', 'Nguyen Trong Tri');
$message->to(Request::input('txtEmail'), Request::input('txtName'))->subject('This is mail');
});
}
return redirect()->route('admin.index')->with('success', 'Added completely!');
}
示例4: createDefaultUserProfile
public function createDefaultUserProfile(User $new_user)
{
$profile = new Profile();
$profile->user_id = $new_user->id;
$profile->about_me = '';
$profile->profile_image_name = UserController::getDefaultImageName();
$profile->save();
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ProfileCreateRequest $request)
{
$profile = new Profile(['nombre' => $request['nombre'], 'apP' => $request['apP'], 'apM' => $request['apM'], 'telefono' => $request['telefono'], 'fechaNac' => $request['telefono'], 'user_id' => $request['id']]);
$profile->save();
$user = User::find($request['id']);
Session::flash('message', 'Datos ingresados Correctamente');
return view('profileUsr.profile', compact('user', 'profile'));
}
示例6: getInsert
public function getInsert()
{
//インスタンス生成
$profile = new Profile();
$profile->name = "fujimon";
$profile->age = 23;
$profile->detail = "ikemen";
//保存
$profile->save();
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(User $user, Request $request)
{
$data = $request->only('name', 'email', 'siteTitle');
$profile = new Profile();
$profile->user_id = $user->id;
$profile->name = $data['name'];
$profile->email = $data['email'];
$profile->siteTitle = $data['siteTitle'];
$profile->save();
return $profile;
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$profile = new Profile();
$profile->name = $request->input('name');
$profile->avatar = $request->input('avatar');
$profile->color = $request->input('color');
// TODO logged in user
$profile->user_id = 1;
$profile->save();
return response()->json(['profile' => $profile]);
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$profile = new Profile();
$profile->user_id = Auth::user()->id;
$profile->name = $request->input('name');
$profile->phone_no = $request->input('phone_no');
$profile->birthdate = $request->input('birthdate');
$profile->experience = $request->input('experience');
$profile->industry_id = $request->input('specialization');
$profile->save();
return view('employees.index', compact('profile'));
}
示例10: confirm
public function confirm($token)
{
$confirm = ConfirmUser::where('token', $token)->firstOrFail();
$user = User::where('email', $confirm->email)->first();
$user->attachRole(3);
$user->status = 1;
$user->save();
$profile = new Profile();
$profile->user_id = $user->id;
$profile->city_id = $confirm->city_id;
$profile->save();
$confirm->delete();
return redirect('auth/login')->with('status', 'Вы успешно потдвердили регистрацию. Теперь войдите в систему используя свой email и пароль.');
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(StoreProfileRequest $request)
{
$profile = new Profile();
$phone = "+" . $request->phone;
$id = Auth::user()->id;
$profile->user_id = $id;
$profile->first_name = $request->first_name;
$profile->last_name = $request->last_name;
$profile->job = $request->job;
$profile->phone = $phone;
$profile->location = $request->location;
$profile->motto = $request->motto;
$profile->about = $request->about;
$profile->save();
return redirect()->route('suite')->with('info', 'You have completed your profile!');
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @param int $iid industry_id
* @param Request $request
* @return Response
*/
public function store($iid, Request $request)
{
$industry = Industry::findOrFail($iid);
$profile = new Profile();
$profile->name = $request->input('name');
$profile->phone_no = $request->input('phone_no');
$profile->birthdate = $request->input('birthdate');
$profile->experience = $request->input('experience');
$profile->industry_id = $iid;
$profile->save();
//$input = $request->all();
//$input['industry_id'] = $iid;
//Profile::create($input);
//return redirect('industries.profiles.show', compact('industry'));
return view('profiles.index', compact('industry'));
}
示例13: confirm
public function confirm($token)
{
$confirm = ConfirmUser::where('token', $token)->firstOrFail();
$user = User::where('email', $confirm->email)->first();
$user->attachRole(3);
$user->status = 1;
$user->save();
$profile = new Profile();
$profile->user_id = $user->id;
$profile->city_id = $confirm->city_id;
$contacts = ['phone' => null, 'telegram' => null, 'whatsapp' => null, 'viber' => null, 'phone2' => null, 'telegram2' => null, 'whatsapp2' => null, 'viber2' => null];
$profile->phone = json_encode($contacts);
$profile->save();
$confirm->delete();
return redirect('auth/login')->with('status', 'Вы успешно потдвердили регистрацию. Теперь войдите в систему используя свой email и пароль.');
}
示例14: create
public function create()
{
$user = Auth::user();
// try to find the profile id that matches the user profile
try {
$profile = Profile::where('user_id', $user->id)->firstOrFail();
} catch (ModelNotFoundException $e) {
// if it fails create profile
$profile = new Profile();
$profile->user_id = $user->id;
$profile->save();
flash()->overlay('Welcome to Baking Amigo!', 'Now tell us a bit about yourself.', 'info');
}
// redirect to the edit page
return redirect("/users/{$user->id}/edit");
}
示例15: uploadTn
public function uploadTn($fileName, $image)
{
$path = public_path('/images/' . Auth::user()->name);
File::exists($path) or File::makeDirectory($path, 0755, true);
$image->save($path . '/' . $fileName)->resize(128, 128)->save($path . '/' . 'pp.jpg');
if (Auth::user()->profile == null) {
$picture = new Profile();
$picture->user_id = Auth::user()->id;
$picture->thumbnailName = 'images/' . Auth::user()->name . '/pp.jpg';
$picture->save();
} else {
$picture = Profile::where('user_id', Auth::user()->id)->first();
$picture->user_id = Auth::user()->id;
$picture->thumbnailName = 'images/' . Auth::user()->name . '/pp.jpg';
$picture->save();
}
}