本文整理汇总了PHP中app\Profile::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::find方法的具体用法?PHP Profile::find怎么用?PHP Profile::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Profile
的用法示例。
在下文中一共展示了Profile::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProfile
public function getProfile(Request $request)
{
$id = $request->input('id');
$profile = Profile::find($id);
$profile->delete();
return response()->json(['status' => 'valid']);
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Profile::truncate();
if (!Profile::find(1)) {
DB::table('profiles')->insert(['user_id' => 1, 'first_name' => 'Uriah', 'last_name' => 'Galang', 'profile_pic' => '/img/avatar.png', 'about_me' => 'Im Your Admin', 'display_name' => 'Master Powers', 'contact_no' => '12345678900', 'address' => 'NPA', 'city' => 'Los Angeles', 'province_state' => 'California', 'zip_code' => '2200', 'country' => 'Uranus', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
}
// $faker = Faker\Factory::create();
// foreach (range(2, 51) as $index) {
// Profile::create([
// 'user_id' => $index,
// 'first_name' => $faker->firstName,
// 'last_name' => $faker->lastName,
// 'profile_pic' => $faker->imageUrl($width = 125, $height = 125),
// 'about_me' => $faker->paragraph(5),
// 'display_name' => $faker->name,
// 'contact_no' => $faker->phoneNumber,
// 'address' => $faker->streetAddress,
// 'city' => $faker->city,
// 'province_state' => $faker->state,
// 'zip_code' => $faker->postcode,
// 'country' => $faker->country,
// 'created_at' => \Carbon\Carbon::now(),
// 'updated_at' => \Carbon\Carbon::now(),
// ]);
// }
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$data = ['first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'address' => Input::get('address'), 'pin' => Input::get('pin'), 'emirate_id' => Input::get('emirate_id'), 'phone' => Input::get('phone')];
// return response()->json($data);
Profile::find($id)->update($data);
return redirect('/home');
}
示例4: store
/** Save a naw post
* @param Request $request
* @return Response of the ajax request.
*/
public function store(Request $request)
{
//ajax storage.
//1. check if its out form.
if (Session::token() !== Input::get('_token')) {
return response()->json(array('message' => 'unauthorized attempt to sent a post'));
}
//get the oldest post id. this will be used to append to the post ul.
$old_post = DB::table('posts')->max('id');
//2. retreive the data in the form.
$post = new Post();
$post->title = Input::get('title');
$post->body = Input::get('body');
$post->post_author_id = Auth::id();
if ($post->save()) {
//get the profile image of the use.
$profile_image_name = Profile::find(Auth::id())->pluck('profile_image_name');
// create a json response and return it.
$response = array('title' => $post->title, 'body' => $post->body, 'post_author_id' => $post->post_author_id, 'user_id' => Auth::id(), 'profile_image_name' => $profile_image_name, 'post_id' => $post->id, 'old_post' => $old_post, 'nickname' => $request->user()->nickname, 'message' => 'Your message has been posted', 'status' => 'success');
return response()->json($response, 200);
} else {
//500 = Internal server error
return response('Sorry, An Error Occurred. Please retry the request', 500);
}
}
示例5: sudoUpdate
/**
* Allow admin to update specific profile.
*
* @param $id
* @param ProfileRequest $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function sudoUpdate($id, ProfileRequest $request)
{
$input = $request->all();
$profile = Profile::find($id);
$profile->update($input);
return redirect('profile/' . $id);
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$user = User::find($id);
$profile = Profile::find($user->id);
$posts = Post::find($user);
TrackerFunctions::log($user->name . " is viewing their own profile ");
return view('profiles.default', compact('user', 'posts', 'profile'));
}
示例7: getApproveProfile
public function getApproveProfile($profileId)
{
$profile = Profile::find($profileId);
$profile->checked = 1;
$profile->isActive = 1;
$profile->save();
return redirect('admin/index');
}
示例8: getProfile
public function getProfile($id)
{
$profile = Profile::find($id);
$posts = $profile->user->posts()->orderBy('id', 'DESC')->get();
$first_number = rand(1, 10);
$second_number = rand(1, 10);
return view('profile.profile_user', compact('posts', 'profile', 'first_number', 'second_number'));
}
示例9: about
public function about()
{
$data = Profile::find(auth()->user()->get('account_id'));
/**
TODO: Довърши страницата about
*/
return view('pages.profile.about')->with('data', $data);
}
示例10: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if (Gate::denies('admin')) {
abort(403);
}
$profile = Profile::find($id);
return view('profiles.show', ['profile' => $profile]);
}
示例11: EditProfile
public function EditProfile($request)
{
$this->request = $request->all();
unset($this->request["access_token"]);
unset($this->request["client_id"]);
$profile = Profile::find($this->request["id"]);
$profile->update($this->request);
return $profile;
}
示例12: setting
public function setting($id)
{
//$accout = Accout::find($id);
$accout = DB::table('users')->find($id);
$ids = $accout->id;
$user = Profile::find($accout->profile_id);
return view('pages.setting', compact('user', 'ids'));
//$profile = App\Profile::find($accout->profile_id);
// return view('pages.setting',compact('user'))->with('user', Profile::find($accout->profile_id) );
}
示例13: getRegister
public function getRegister()
{
$switch = DB::table('xt')->where('c_id', '=', 'XS_DEXWBM')->first();
if ($switch->c_value == 0) {
return redirect('user/ban')->with('message', '现在还没有开放双学士学位教育网上报名,以便确认您的修读资格,谢谢。');
}
$profile = Profile::find(Auth::user()->xh);
if (is_null($profile)) {
return redirect('user/ban')->with('message', '双学士学位教育只限在校学生报名,其它学籍状态的同学如果需要报名,请直接联系相关学院,其联系方式见《广西师范大学2015年“双学士学位”教育招生简章》,以便确认您的修读资格,谢谢。');
}
if ($profile->nj != '2014') {
return redirect('user/ban')->with('message', '2015年双学士学位教育只限2014级学生报名,其它年级的同学如果需要报名,请直接联系相关学院,其联系方式见《广西师范大学2015年“双学士学位”教育招生简章》,以便确认您的修读资格,谢谢。');
}
$majors = DB::table('xt_zybh')->join('jx_jxjh', 'jx_jxjh.c_zy', '=', 'xt_zybh.c_zy')->where('jx_jxjh.c_nj', '=', $profile->nj + 2)->where('jx_jxjh.c_zsjj', '=', '0')->select('xt_zybh.c_zy', 'xt_zybh.c_mc')->orderBy('xt_zybh.c_zy')->distinct()->get();
$student = DB::table('xs_xsb')->join('xt_zybh', 'xt_zybh.c_zy', '=', 'xs_xsb.c_zyh')->join('xt_yxzy', 'xt_yxzy.c_zy', '=', 'xt_zybh.c_zy')->join('xt_yxbh', 'xt_yxbh.c_xb', '=', 'xt_yxzy.c_yx')->select('c_xh', 'c_xm', 'c_zyh', 'c_lxdh', 'c_sfzh', 'xt_zybh.c_mc as zymc', 'xt_yxbh.c_mc as yxmc')->where('c_xh', '=', Auth::user()->xh)->first();
return view('register', ['title' => '广西师范大学双学位报名系统', 'profile' => $profile, 'majors' => $majors, 'student' => $student]);
}
示例14: process
public function process(Request $request)
{
$profile = Profile::find($request->input('profile_id'));
$response = $request->input('response', 0);
$message = null;
if ($response > 0) {
if ($response == 1 || $response == 2) {
$message = "Congratulations! You have successfully voted for " . $profile->name . " as miss/mister rwanda belgium 2016";
Flash::success($message);
}
if ($response == 3) {
$message == "There's an error, Please try again later...";
Flash::error($message);
}
if ($response == 4) {
$message = "Oops.. You can only vote one time in five minutes, try again in 5 minutes";
Flash::warning($message);
}
}
return redirect('/');
}
示例15: handle
/**
* Handle the event.
*
* @param \App\Events\WechatUserSubscribed $event
* @return \App\Models\Message
*/
public function handle(WechatUserSubscribed $event)
{
$m = $event->message;
/**
* openId is always unique to our official account, so if user subscribes
* again, we just need to toggle un-subscribed flag.
*/
if ($subscriber = Subscriber::where('openId', $m->fromUserName)->where('unsubscribed', true)->first()) {
$subscriber->unsubscribed = false;
} else {
$subscriber = new Subscriber();
$subscriber->openId = $m->fromUserName;
}
$subscriber->save();
// Link profile with subscriber if subscribe comes from profile page.
if ($key = $m->messageable->eventKey) {
Profile::find(Str::substr($key, Str::length('qrscene_')))->update(['weixin' => $m->fromUserName]);
event(new ChangeSubscriberGroup($subscriber));
}
return $this->greetMessage($m->fromUserName, !is_null($key));
}