本文整理汇总了PHP中app\Member::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::where方法的具体用法?PHP Member::where怎么用?PHP Member::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit(Request $request)
{
$rules = array('fullname' => 'required', 'address' => 'required', 'zipcode_id' => 'required');
$validator = \Validator::make($request->all(), $rules);
if ($validator->fails()) {
return Response::json(array('result' => false, 'data' => 'ข้อมูลผิดพลาด', 'message' => $validator->messages()->all()));
}
$user = \Auth::user();
if ($user == null) {
return Response::json(array('result' => false, 'data' => 'can not define user.'));
}
$member = Member::where('id', $user->id)->first();
//var_dump($member);
$member->fullname = $request->input('fullname');
$member->address = $request->input('address');
$member->district_id = $request->input('district_id');
$member->amphur_id = $request->input('amphur_id');
$member->province_id = $request->input('province_id');
$member->zipcode_id = $request->input('zipcode_id');
if ($member->save()) {
return Response::json(array('result' => true, 'data' => 'บันทึกข้อมูลเสร็จเรียบร้อย'));
} else {
return Response::json(array('result' => false, 'data' => 'เกิดข้อผิดพลาด'));
}
}
示例2: testDeleteMember
/**
* Fonction permettant de tester la
* suppression d'un membre d'un projet
*
* @return void
*/
public function testDeleteMember()
{
Member::create(["project_id" => 2, "Developer_id" => 2]);
$cnt = new MemberController();
$cnt->remove(2, 2);
$this->assertEquals(null, Member::where("project_id", 2)->where("Developer_id", 2)->get()->first());
}
示例3: showMember
public function showMember(Request $r)
{
$member = Member::where("id", $r->input('id'))->get();
$hc = new HomeController();
$vars = $hc->getVars();
return view('member', ['member' => $member[0], "lang" => "fa", "vars" => $vars]);
}
示例4: projectList
public function projectList()
{
$projects_member_id = Member::where("Developer_id", auth()->User()->id)->get()->pluck("project_id");
$project_owner_id = Project::where("developer_id", auth()->User()->id)->get()->pluck("id");
$projects_id = array_merge($projects_member_id->toArray(), $project_owner_id->toArray());
$project = Project::whereIn("id", $projects_id)->get();
$developer = DB::table('Developer')->get();
return view("project.list")->with('project', $project)->with('developer', $developer);
}
示例5: filter
public function filter()
{
$input = Request::all();
$filter = $input['filter'];
$members = Member::where('department', $filter)->get();
if ($members == "[]") {
return redirect()->action('TambayPointsController@index');
}
return view('tambay_points.index', compact('members'));
}
示例6: findMemberByDocument
public function findMemberByDocument(Request $request)
{
$member = Member::where('document', $request->documento)->first();
//dd($member);
if ($member == null) {
Flash::warning("No existe nungun miembro con el documento " . $request->documento . " registrado");
return redirect()->route('admin.member.index');
} else {
return redirect()->route('admin.member.show', ['member' => $member]);
}
}
示例7: memberLogin
public function memberLogin(\Illuminate\Http\Request $request)
{
$member = Member::where('email', $request->email)->where('password', $request->password)->get();
//return $member[0]->id;
if (!$member->isEmpty()) {
//$halls=Hall::where('member_id',$member[0]->id)
$hall = Hall::where('member_id', $member[0]->id)->get();
$hall = $hall[0];
//dd($hall);
return Redirect('members/settings')->with('hall', $hall);
}
return "Login Failed";
}
示例8: update
public function update(Request $request)
{
$validator = Validator::make($request->all(), ['id' => 'required', 'point' => 'integer']);
if ($validator->fails()) {
return Response::json(array('result' => false, 'data' => 'Input is valid.'));
}
$member = Member::where('id', $request->input('id'))->get()->first();
if ($member) {
$member->fullname = $request->input('fullname');
$member->address = $request->input('address');
$member->phone = $request->input('phone');
$member->province_id = $request->input('province_id');
$member->amphur_id = $request->input('amphur_id');
$member->district_id = $request->input('district_id');
$member->zipcode_id = $request->input('zipcode_id');
$member->point = $request->input('point');
$member->save();
return Response::json(array('result' => true, 'data' => 'Update ' . $member->email . ' success.'));
}
return Response::json(array('result' => false, 'data' => 'Update ' . $member->email . ' fail.', 'member' => $member));
}
示例9: destroy
/**
* Remove the specified resource from storage.
* Defaults to a soft delete; add ?remove=permanent to do hard delete
*
* @param int $id
* @return Response
*/
public function destroy(Request $request, $id)
{
// remove -- [ discharge | permanent ]
$removeMode = $request->query('remove', 'discharge');
$deleted = 0;
try {
if ($removeMode == 'permanent') {
$deletionMember = Member::where('regt_num', $id)->withTrashed()->firstOrFail();
// Todo: future permissions check
$permissionsCheck = true;
if ($permissionsCheck || $deletionMember->is_active == '0') {
// Allow anybody to delete inactive records
$deletionMember->postings()->forceDelete();
$deletionMember->forceDelete();
// this returns void
$deleted = true;
// we just presume it worked, since we deleted the postings already
} else {
throw new \Exception('You don\'t have permission to permanently delete this record', ResponseCodes::ERR_PERM_NOPE);
}
} else {
// Soft delete -- read overrides from context
$deleted = Member::findOrFail($id)->delete();
}
return response()->json(['success' => $deleted, 'deletionMode' => $removeMode]);
} catch (\Exception $ex) {
if (!$deleted) {
return response()->json(['error' => ['code' => ResponseCodes::ERR_DELETION, 'deletionResult' => print_r($deleted, true), 'reason' => "Could not delete this record {$id}"]], 401);
} else {
return response()->json(['error' => ['code' => $ex->getCode(), 'reason' => $ex->getMessage()]], 403);
}
}
}
示例10: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id The id of the member to delete
* @return Response
*/
public function destroy($id)
{
// Find member
$member = Member::findOrFail($id);
// Find members of the same perifereia with order bigger than this member's and fix them
$membersToFix = Member::where('district_id', '=', $member->district->id)->where('order', '>', $member->order)->get();
foreach ($membersToFix as $m) {
$m->order = $m->order - 1;
$m->save();
}
// Delete the member
$member->delete();
// Redirect
Session::flash('message', 'Ο/Η βουλευτής διαγράφηκε με επιτυχία!');
return Redirect::to('members');
}
示例11: postResetPassword
public function postResetPassword(){
$user = Member::where('username',$this->request->input('username'))->first();
$validator = Validator::make($this->request->all(), [
'username' =>'required|min:10|max:20|exists:member,username',
'new_password'=>'required|min:10|max:20',
'secretanswer'=>'required|min:1|max:100|exists:member,secretanswer,username,'.$user['username']
]);
if ($validator->fails()){
return view('resetpassword')->with('cart',$this->getCart())
->with('username',$user->username)
->with('secretquestion',$user->secretquestion)
->with('ferrors',$validator->errors());
}else{
$user = Member::where('username',$this->request->input('username'))->first();
$user->password = $this->request->input('new_password');
$user->save();
return view('login')->with('cart',$this->getCart())
->with('success','Your account password has been successfully reset.');
}
}
示例12: index
public function index($memberId)
{
$memberPostingRecords = Member::where('regt_num', $memberId)->withTrashed()->get();
return response()->json($memberPostingRecords->postings->toArray());
}
示例13: block
public function block($id)
{
$ret = Member::where('id', $id)->first();
if ($ret->status == 1) {
$update = \DB::table('members')->where('id', $id)->update(['status' => 0]);
Session::flash('blockmessage', 'Member has been blocked successfully');
} else {
$update = \DB::table('members')->where('id', $id)->update(['status' => 1]);
Session::flash('unblockmessage', 'Member has been unblocked successfully');
}
Session::flash('memberid', $ret->type);
return \Redirect::to('member/show');
}
示例14: forUser
public function forUser(User $user)
{
return Member::where('user_id', $user->id)->orderBy('created_at', 'desc')->get();
}
示例15: changeProfile
/**
* Change Account Basic details
*
* @param Request $request
* @return Response
*/
public function changeProfile(Request $request)
{
$this->validate($request, ['current_password' => 'required|min:6']);
$user = Auth::user();
if ($user->type == 'studio') {
$this->validate($request, ['name' => 'required']);
} else {
$this->validate($request, ['firstname' => 'required']);
}
if ($user->email != $request->input('email')) {
$this->validate($request, ['email' => 'required|email|max:255|unique:users']);
}
if ($user->contact != $request->input('contact')) {
$this->validate($request, ['contact' => 'required|digits:10']);
}
if (Hash::check($request->input('current_password'), $user->password)) {
if ($user->type == 'artist') {
$artist = Artist::where('user_id', $user->id)->first();
$artist->firstname = $request->input('firstname');
$artist->lastname = '';
$artist->save();
$user->name = $request->input('firstname');
} elseif ($user->type == 'member') {
$member = Member::where('user_id', $user->id)->first();
$member->firstname = $request->input('firstname');
$member->lastname = '';
$member->save();
$user->name = $request->input('firstname');
} elseif ($user->type == 'studio') {
$studio = Studio::where('user_id', $user->id)->first();
$studio->title = '';
$studio->name = $request->input('name');
$studio->save();
$user->name = $request->input('name');
}
$user->email = $request->input('email');
$user->contact = $request->input('contact');
$user->save();
return redirect('profile#edit')->with('success', 'Profile changed successfully!');
}
return redirect('profile#edit')->with('warning', 'Wrong Password!');
}