本文整理汇总了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));
}
}