当前位置: 首页>>代码示例>>PHP>>正文


PHP Members::find方法代码示例

本文整理汇总了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);
 }
开发者ID:mitap45,项目名称:Daily,代码行数:28,代码来源:HomeController.php

示例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')));
 }
开发者ID:mitap45,项目名称:Daily,代码行数:21,代码来源:AdminController.php

示例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));
     }
 }
开发者ID:mitap45,项目名称:Daily,代码行数:29,代码来源:MemberController.php


注:本文中的Members::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。