本文整理匯總了PHP中Members::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Members::find方法的具體用法?PHP Members::find怎麽用?PHP Members::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Members
的用法示例。
在下文中一共展示了Members::find方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: showMemberProfile
public function showMemberProfile($memberID)
{
$value = Session::get('key');
$member = Members::find($memberID);
$posts = DB::table('posts')->join('members', 'members.memberID', '=', 'posts.memberID')->where('members.memberID', $memberID)->get();
$followings = DB::table('follow')->join('members', 'members.memberID', '=', 'follow.followMemberID')->where('follow.memberID', $memberID)->select('members.name', 'members.surname', 'members.memberID', 'members.photo')->get();
$followers = DB::table('follow')->join('members', 'members.memberID', '=', 'follow.memberID')->where('follow.followMemberID', $memberID)->select('members.name', 'members.surname', 'members.memberID', 'members.photo')->get();
$follow = false;
foreach ($followers as $f) {
//takipçilerinde oturumu açık olan kişi varsa follow true
if ($f->memberID == $value) {
$follow = true;
}
}
$data = array('member' => $member, 'posts' => $posts, 'follow' => $follow, 'followers' => $followers, 'followings' => $followings);
if (Session::get('adminLoggedIn')) {
return View::make('admin/showMemberProfileForAdmin', $data);
}
if ($value == "") {
//Session yoksa
return View::make('showMemberProfile', $data);
}
if ($value == $memberID) {
//Kendi profili ise kendi profiline yönlendirilir.
return Redirect::to('profile');
}
return View::make('member/showMemberProfilForMember', $data);
}
示例2: deleteMember
public function deleteMember($memberID)
{
$member = Members::find($memberID);
if (Session::get('adminLoggedIn')) {
//adminse silebilir.
$member->delete();
return Redirect::to('admin');
}
if (Input::get('memberID') == Session::get('key')) {
//silmek istediği hesap kendi hesabı ise
$member->delete();
Session::flush();
return Redirect::to('login');
}
if (Session::get('key') == "") {
//giriş yapılmamış ise
return View::make('login', array('message' => 'Bu işlemi yapma yetkiniz yoktur.'));
}
$posts = DB::table('posts')->join('members', 'members.memberID', '=', 'posts.memberID')->get();
return View::make('member/homepage', array('message' => 'Bu işlemi yapma yetkiniz yoktur.', 'posts' => $posts, 'memberID' => Session::get('key')));
}
示例3: memberPhotoUpdate
public function memberPhotoUpdate()
{
$member = Members::find(Session::get('key'));
if (Input::hasFile('image')) {
$file = array('image' => Input::file('image'));
$rules = array('image' => 'required');
$validator = Validator::make($file, $rules);
if ($validator->fails()) {
return "Hata";
} else {
if (Input::file('image')->isValid()) {
$image = Input::file('image');
$filename = $image->getClientOriginalName();
$destinationPath = base_path() . '/public/uploads/';
$image->move(public_path('uploads'), $filename);
$path = $destinationPath . $filename;
$path = "/daily/public/uploads/" . $filename;
$image->picture_path = $path;
$member->photo = $path;
$member->save();
return View::make('member/settings', array('message' => "Fotoğrafınız başarıyla eklenmiştir.", 'member' => $member));
} else {
return View::make('member/settings', array('message' => "Lütfen geçerli bir fotoğraf yükleyin.", 'member' => $member));
}
}
} else {
return View::make('member/settings', array('message' => "Lütfen fotoğraf yükleyin.", 'member' => $member));
}
}