本文整理汇总了PHP中Connection::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::find方法的具体用法?PHP Connection::find怎么用?PHP Connection::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::find方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$CurrentUser = Auth::User();
//echo "<pre>";print_r($CurrentUser);echo "</pre>";
//$IntroducerInitiated = Auth::User()->Introducer;
$IntroducerInitiated = DB::select(DB::raw("select * from requests where requests.user_id_introducer= " . $CurrentUser->id . " order by requests.updated_at DESC"));
//echo "<pre>";print_r($IntroducerInitiated->toArray());echo "</pre>";
//echo "<pre>";print_r($IntroducerInitiated1);echo "</pre>";
foreach ($IntroducerInitiated as $key => $value) {
$value->user_id_receiver = User::find($value->user_id_receiver);
if (!empty($value->user_id_giver)) {
$value->user_id_giver = User::find($value->user_id_giver);
} else {
$value->user_id_giver = Connection::find($value->connection_id_giver);
}
}
//echo "<pre>";print_r($IntroducerInitiated);echo "</pre>";die();
$totalintroductionInitiated = count($IntroducerInitiated);
return View::make('karmaIntro', array('pageTitle' => 'Intro | KarmaCircles', 'CurrentUser' => $CurrentUser, 'IntroducerInitiated' => $IntroducerInitiated, 'totalintroductionInitiated' => $totalintroductionInitiated, 'countIntro' => '0'));
}
示例2: remove
public function remove($id)
{
$connection = Connection::find($id);
$connection->delete();
return Redirect::to("connections/index")->with('message', "success::Conexão removida com sucesso!");
}
示例3: sendActivationMessage
public static function sendActivationMessage($user_info)
{
$subject = "Welcome to KarmaCircles";
$Content = "Your KarmaCircles account is activated now.";
$type = "11";
$user_id = $user_info->id;
$location = $user_info->location;
// fetch user connections on KC
$getUserConnection = KarmaHelper::getUserConnection($user_id, $location);
$user_connection_onkc = 0;
if (!empty($getUserConnection)) {
foreach ($getUserConnection as $key => $value) {
if (isset($value->con_user_id)) {
$user_connection_onkc++;
}
}
}
// fetch pending karmanote requests
$totalPendingRequest = 0;
$PendingRequest = array();
$PendingRequest = KarmaHelper::getPendingKarmaNotes($user_info->id);
if (!empty($PendingRequest)) {
$totalPendingRequest = count($PendingRequest);
}
//fetch pending KM requests only received no read no unread
$totalReceivedRequest = 0;
$GiverInMeeting = User::find($user_info->id)->Giver()->where('status', 'pending')->orderBy('updated_at', 'DESC')->get();
if (!empty($GiverInMeeting)) {
$totalReceivedRequest = count($GiverInMeeting);
}
//fetch pending karma intros
$totalintroductionInitiated = 0;
$IntroducerInitiated = User::find($user_info->id)->Introducer;
if (!empty($IntroducerInitiated)) {
foreach ($IntroducerInitiated as $key => $value) {
$value['user_id_receiver'] = User::find($value['user_id_receiver'])->toArray();
if (!empty($value['user_id_giver'])) {
$value['user_id_giver'] = User::find($value['user_id_giver'])->toArray();
} else {
$value['user_id_giver'] = Connection::find($value['connection_id_giver'])->toArray();
}
if ($value->status == 'pending') {
$totalintroductionInitiated++;
}
}
}
// fetch queries that have been posted in the last 7 days within common groups including both public & private.
$Usergroup = User::find($user_info->id)->Groups;
$All_groups = '';
$group_question = 0;
$totagroupquestion = 0;
$yesterday = Carbon::now()->subDays(1);
$one_week_ago = Carbon::now()->subWeeks(1);
if (!$Usergroup->isEmpty()) {
foreach ($Usergroup as $key => $value) {
$All_groups[] = $value->id;
}
if (!empty($All_groups)) {
$group_question = DB::table('group_questions')->join('questions', 'group_questions.question_id', '=', 'questions.id')->select(array('questions.id'))->whereIn('group_questions.group_id', $All_groups)->where('questions.user_id', '!=', $user_info->id)->where('questions.queryStatus', '=', 'open')->where('questions.created_at', '>=', $one_week_ago)->where('questions.created_at', '<=', $yesterday)->orderBy('questions.created_at', 'DESC')->groupBy('question_id')->get();
if (!empty($group_question)) {
$totagroupquestion = count($group_question);
}
}
}
// fetch weekly suggestion option value set from admin
$weekly_suggestion = "KarmaNote";
$weekly_suggestion = Adminoption::Where("option_name", "=", "Weekly Suggestion")->select("option_value")->first();
if (!empty($weekly_suggestion)) {
$weekly_suggestion = $weekly_suggestion->option_value;
}
$getkcUser = $getsuggestion = array();
if ($weekly_suggestion == "KarmaMeeting") {
// fetch a random users on KC platform with a common group of logged in user
$getkcUser = KarmaHelper::fetchUserGroup($user_id);
if (!empty($getkcUser)) {
$getkcUser = $getkcUser[0];
}
} else {
// fetch a user connection either KC or NON KC
$getsuggestion = KarmaHelper::getUserConnection($user_id, $location);
//get test users id
$getUser = KarmaHelper::getTestUsers();
if (!empty($getsuggestion)) {
foreach ($getsuggestion as $key => $value) {
$test_match = in_array($value->con_user_id, $getUser);
if ($value->con_user_id != "" && $test_match != 1) {
$getKc = DB::table('users as u')->select(array('u.userstatus', 'u.id', 'u.fname', 'u.lname', 'u.linkedinurl', 'u.piclink', 'u.headline', 'u.email', 'u.karmascore', 'u.location'))->where('u.id', '=', $value->con_user_id)->where('u.userstatus', '=', 'approved')->get();
if (!empty($getKc)) {
$value->networkid = $getKc;
}
}
}
$getsuggestion = $getsuggestion[array_rand($getsuggestion)];
}
}
$getkcUser = (array) $getkcUser;
$getsuggestion = (array) $getsuggestion;
/*echo"<pre>";print_r($getkcUser);echo"</pre>";
echo"<pre>";print_r($getsuggestion);echo"</pre>";
die;*/
//.........这里部分代码省略.........
示例4: fire
public function fire()
{
//fetch all users
$getusers = DB::table('users')->select(array('users.*'))->where('users.userstatus', '=', 'approved')->orderBy('created_at', 'DESC')->get();
//process for the records found
if (!empty($getusers)) {
$queryOfferHelp = array();
foreach ($getusers as $user_info) {
$diffDate = KarmaHelper::dateDiff(date("Y-m-d H:i:s"), $user_info->created_at);
if ($diffDate->days > -1) {
$user_id = $user_info->id;
$location = $user_info->location;
/*$myKarmaDataOfInCompleteState= DB::select(DB::raw("SELECT COUNT( * ) AS AGGREGATE FROM `users_mykarma` WHERE `status` = 'completed' AND `user_id` =".$user_id." AND created_at > DATE_SUB(NOW(), INTERVAL 1 DAY)"));
$myKarmaDataOfInCompleteState= DB::select(DB::raw("SELECT COUNT( * ) AS AGGREGATE FROM `users_mykarma` WHERE `status` != 'completed' AND `user_id` =".$user_id." AND created_at > DATE_SUB(NOW(), INTERVAL 1 DAY)"));*/
$myKarmaDataOfCompleteState = Mykarma::where('status', '=', 'completed')->where('user_id', '=', $user_id)->where('unread_flag', '=', 'true')->where('created_at', '>=', Carbon::now()->subDay(1))->count();
$myKarmaDataOfInCompleteState = Mykarma::where('status', '!=', 'completed')->where('user_id', '=', $user_id)->where('entry_type', '=', 'Meeting')->where('unread_flag', '=', 'true')->where('created_at', '>=', Carbon::now()->subDay(1))->count();
$myKarmaDataOfQuery = Mykarma::where('user_id', '=', $user_id)->where('entry_type', '=', 'Query')->get();
foreach ($myKarmaDataOfQuery as $key => $value) {
$allQuery[] = $value->entry_id;
}
if (!empty($allQuery)) {
$queryOfferHelp = Mykarma::whereIn('entry_id', $allQuery)->where('users_role', '=', 'OfferedHelp')->where('unread_flag', '=', 'true')->where('created_at', '>=', Carbon::now()->subDay(1))->count();
}
// fetch user connections on KC
$getUserConnection = KarmaHelper::getUserConnection($user_id, $location);
$user_connection_onkc = 0;
if (!empty($getUserConnection)) {
foreach ($getUserConnection as $key => $value) {
if (isset($value->con_user_id)) {
$user_connection_onkc++;
}
}
}
// fetch pending karmanote requests
$totalPendingRequest = 0;
$PendingRequest = array();
$PendingRequest = KarmaHelper::getPendingKarmaNotes($user_info->id);
if (!empty($PendingRequest)) {
$totalPendingRequest = count($PendingRequest);
}
//fetch pending KM requests only received no read no unread
$totalReceivedRequest = 0;
$GiverInMeeting = User::find($user_info->id)->Giver()->where('status', 'pending')->orderBy('updated_at', 'DESC')->get();
if (!empty($GiverInMeeting)) {
$totalReceivedRequest = count($GiverInMeeting);
}
//fetch pending karma intros
$totalintroductionInitiated = 0;
$IntroducerInitiated = User::find($user_info->id)->Introducer;
if (!empty($IntroducerInitiated)) {
foreach ($IntroducerInitiated as $key => $value) {
$value['user_id_receiver'] = User::find($value['user_id_receiver'])->toArray();
if (!empty($value['user_id_giver'])) {
$value['user_id_giver'] = User::find($value['user_id_giver'])->toArray();
} else {
$value['user_id_giver'] = Connection::find($value['connection_id_giver'])->toArray();
}
if ($value->status == 'pending') {
$totalintroductionInitiated++;
}
}
}
// fetch queries that have been posted in the last 7 days within common groups including both public & private.
$Usergroup = User::find($user_info->id)->Groups;
$All_groups = '';
$group_question = 0;
$totagroupquestion = 0;
$yesterday = Carbon::now()->subDays(1);
$one_week_ago = Carbon::now()->subWeeks(1);
if (!$Usergroup->isEmpty()) {
foreach ($Usergroup as $key => $value) {
$All_groups[] = $value->id;
}
if (!empty($All_groups)) {
$group_question = DB::table('group_questions')->join('questions', 'group_questions.question_id', '=', 'questions.id')->select(array('questions.id'))->whereIn('group_questions.group_id', $All_groups)->where('questions.user_id', '!=', $user_info->id)->where('questions.queryStatus', '=', 'open')->where('questions.created_at', '>=', $one_week_ago)->where('questions.created_at', '<=', $yesterday)->orderBy('questions.created_at', 'DESC')->groupBy('question_id')->get();
if (!empty($group_question)) {
$totagroupquestion = count($group_question);
}
}
}
// fetch weekly suggestion option value set from admin
$weekly_suggestion = "KarmaNote";
$weekly_suggestion = Adminoption::Where("option_name", "=", "Weekly Suggestion")->select("option_value")->first();
if (!empty($weekly_suggestion)) {
$weekly_suggestion = $weekly_suggestion->option_value;
}
$getkcUser = $getsuggestion = array();
if ($weekly_suggestion == "KarmaMeeting") {
// fetch a random users on KC platform with a common group of logged in user
$getkcUser = KarmaHelper::fetchUserGroup($user_id);
if (!empty($getkcUser)) {
$getkcUser = $getkcUser[0];
}
} else {
// fetch a user connection either KC or NON KC
$getsuggestion = KarmaHelper::getUserConnection($user_id, $location);
//get test users id
$getUser = KarmaHelper::getTestUsers();
if (!empty($getsuggestion)) {
foreach ($getsuggestion as $key => $value) {
//.........这里部分代码省略.........
示例5: updateKarmaNoteStatus
/**
* Function name: updateKarmaNoteStatus()
* Created by : Evon
* Created on : 04/10/2014
* Arguments : $noteId, $status
**/
public function updateKarmaNoteStatus()
{
$CurrentUser = Auth::user();
$user_id = $noteId = $status = '';
$user_id = Input::get('user_id');
$noteId = Input::get('noteId');
$status = Input::get('status');
$publicPage = Input::get('publicPage');
if ($user_id && $noteId && $status) {
if ($user_id == 'receiver') {
$updateColumn = 'statusreceiver';
} else {
$updateColumn = 'statusgiver';
}
if ($status == 'Hide') {
$updateStatus = 'hidden';
} elseif ($status == 'Show') {
$updateStatus = 'visible';
}
$KarmaNotes = Karmanote::find($noteId);
$KarmaNotes->{$updateColumn} = $updateStatus;
$KarmaNotes->save();
$KarmaNotes = $KarmaNotes->toArray();
$Meetingrequest = Meetingrequest::find($KarmaNotes['req_id']);
$receiverDetail = User::find($Meetingrequest->user_id_receiver)->toArray();
//echo "<pre>";print_r($Meetingrequest);echo "</pre>";die;
if (!empty($Meetingrequest->user_id_giver)) {
$giverDetail = User::find($Meetingrequest->user_id_giver)->toArray();
} else {
$giverDetail = Connection::find($Meetingrequest->connection_id_giver)->toArray();
}
if ($publicPage == '1') {
return Redirect::to('profile/' . strtolower($CurrentUser->fname . '-' . $CurrentUser->lname) . '/' . $CurrentUser->id);
} else {
return Redirect::to('KarmaNotes');
}
} else {
return Redirect::to('404');
}
}
示例6: getAdminReportMeet
public static function getAdminReportMeet($request_id, $user_id, $begin, $end)
{
$getUser = "";
$getUser = KarmaHelper::getTestUsers();
$testchk = in_array($user_id, $getUser);
/*echo $chk;
die();*/
if ($request_id == 0) {
/*$query = DB::table('requests');
if ( $user_id !=0 && $testchk !=1) {
$query->where('requests.user_id_receiver', '=', $user_id);
$query->orwhere('requests.user_id_giver', '=', $user_id);
$query->orwhere('requests.connection_id_giver', '=', $user_id);
}
if ( $begin != 0 && $end != 0){
$query->whereBetween('requests.created_at', array("'".$begin."'", "'".$end."'"));
}
$meetTrail = $query
//->WhereNotIn('requests.user_id_receiver',$getUser)
//->WhereNotIn('requests.user_id_giver',$getUser)
//->orWhereNotIn('requests.connection_id_giver',$getUser)
->orderBy('requests.created_att','desc')
->select('requests.*')
->distinct()
->get(); */
if ($user_id != 0 && $testchk != 1 && $begin != 0 && $end != 0) {
$meetTrail = DB::select(DB::raw("select `requests`.* from `requests` where (`requests`.`user_id_receiver` = " . $user_id . " or `requests`.`user_id_giver` = " . $user_id . " or `requests`.`connection_id_giver` = " . $user_id . " ) and `requests`.`created_at` between '" . $begin . "' and '" . $end . "' order by `requests`.`created_at` desc"));
}
if ($user_id == 0 && $begin != 0 && $end != 0) {
$meetTrail = DB::select(DB::raw("select `requests`.* from `requests` where `requests`.`created_at` between '" . $begin . "' and '" . $end . "' order by `requests`.`created_at` desc"));
}
if ($user_id == 0 && $begin == 0 && $end == 0) {
$meetTrail = DB::select(DB::raw("select `requests`.* from `requests` order by `requests`.`created_at` desc"));
}
//echo"<pre>==".$user_id."====";print_r($meetTrail);echo"</pre>=====";
} else {
$meetTrail = DB::table('requests')->where('requests.id', '=', $request_id)->orderBy('requests.created_at', 'desc')->select('requests.*')->distinct()->first();
}
if (!empty($meetTrail)) {
$meetTrail = (array) $meetTrail;
foreach ($meetTrail as $key => $value) {
if (isset($value->user_id_introducer)) {
$introducer = in_array($value->user_id_introducer, $getUser);
if ($introducer != 1) {
$value->user_id_introducer = User::find($value->user_id_introducer);
} else {
$value->user_id_introducer = "";
}
}
if (isset($value->user_id_receiver)) {
$rcvr = in_array($value->user_id_receiver, $getUser);
if ($rcvr != 1) {
$value->user_id_receiver = User::find($value->user_id_receiver)->toArray();
} else {
$value->user_id_receiver = "";
}
}
if (!empty($value->user_id_giver)) {
$giver = in_array($value->user_id_giver, $getUser);
if ($giver != 1) {
$value->user_id_giver = User::find($value->user_id_giver)->toArray();
}
} else {
if (isset($value->connection_id_giver)) {
$connection = in_array($value->connection_id_giver, $getUser);
if ($connection != 1) {
$value->user_id_giver = Connection::find($value->connection_id_giver)->toArray();
} else {
$value->user_id_giver = "";
}
}
}
}
}
return $meetTrail;
}
示例7: loadmoreProfile
public function loadmoreProfile()
{
//Karma notes block
$karmaTrailUser = $karmaReceivedUser = $karmaSentUser = '';
$profileSelf = 0;
$CurrentUserDetail = "";
$CurrentUserId = 0;
if (!empty($_REQUEST)) {
$start = $_REQUEST['hitcount'] + 1;
$action = $_REQUEST['action'];
$id = $_REQUEST['userProfile'];
$perpage = 10;
$profileUserDetail = User::find($id);
if (Auth::check()) {
$CurrentUserDetail = Auth::User();
$CurrentUserId = $CurrentUserDetail->id;
if ($CurrentUserId == $profileUserDetail['id']) {
$profileSelf = "1";
} else {
$profileSelf = "0";
}
}
if ($action == 'KarmaTrail') {
$karmaTrail = KarmaHelper::getKarmaTrail($id, $start, $perpage);
if (count($karmaTrail) > 0) {
foreach ($karmaTrail as $trail) {
$userSkills = "";
$karma['user_id_receiver'] = User::find($trail->user_id_receiver)->toArray();
if (!empty($trail->user_id_giver)) {
$karma['user_id_giver'] = User::find($trail->user_id_giver)->toArray();
} else {
$karma['user_id_giver'] = Connection::find($trail->connection_id_giver)->toArray();
}
if ($id == $trail->user_id_receiver) {
$karma['status'] = $trail->statusreceiver;
} else {
$karma['status'] = $trail->statusgiver;
}
$karma['piclink'] = $trail->piclink;
$karma['karmaNotes'] = $trail->details;
if (!empty($trail->skills)) {
$userSkills = KarmaHelper::getSkillsname($trail->skills);
}
$karma['skills'] = $userSkills;
$karma['req_id'] = $trail->req_id;
$karma['meetingdatetime'] = date('F d, Y', strtotime($trail->meetingdatetime));
$karma['created_at'] = date('F d, Y', strtotime($trail->created_at));
$karmaTrailUser[] = $karma;
}
}
}
//echo "<pre>";print_r($karmaTrailUser);echo "</pre>";die;
if ($action == 'KarmaNotesReceived') {
$karmaReceived = $profileUserDetail->KarmanoteReceiver()->orderBy('karmanotes.created_at', 'desc')->skip($start)->take($perpage)->get();
if (!empty($karmaReceived)) {
foreach ($karmaReceived->toArray() as $received) {
$userReceivedSkills = "";
$karmareceived['user_id_receiver'] = User::find($received['user_idreceiver'])->toArray();
if (!empty($received['user_id_giver'])) {
$karmareceived['user_id_giver'] = User::find($received['user_idgiver'])->toArray();
} else {
$karmareceived['user_id_giver'] = Connection::find($received['connection_idgiver'])->toArray();
}
$karmareceived['karmaNotes'] = $received['details'];
if (!empty($received['skills'])) {
$userReceivedSkills = KarmaHelper::getSkillsname($received['skills']);
}
$karmareceived['skills'] = $userReceivedSkills;
$karmareceived['status'] = $received['statusgiver'];
$karmareceived['req_id'] = $received['req_id'];
$karmareceived['req_detail'] = Meetingrequest::find($received['req_id']);
$karmareceived['created_at'] = date('F d, Y', strtotime($received['created_at']));
$karmaReceivedUser[] = $karmareceived;
}
}
}
//echo "<pre>";print_r($karmaReceived->toArray());echo "</pre>";die;
if ($action == 'KarmaNotesSent') {
$karmaSent = $profileUserDetail->KarmanoteGiver()->orderBy('karmanotes.created_at', 'desc')->skip($start)->take($perpage)->get();
//echo "<pre>";print_r($karmaSent->toArray());echo "</pre>";die;
if (!empty($karmaSent)) {
foreach ($karmaSent->toArray() as $sent) {
$userSentSkills = "";
$karmasent['user_id_receiver'] = User::find($sent['user_idreceiver'])->toArray();
if (!empty($sent['user_idgiver'])) {
$karmasent['user_id_giver'] = User::find($sent['user_idgiver'])->toArray();
} else {
$karmasent['user_id_giver'] = Connection::find($sent['connection_idgiver'])->toArray();
}
$karmasent['karmaNotes'] = $sent['details'];
if (!empty($sent['skills'])) {
$userSentSkills = KarmaHelper::getSkillsname($sent['skills']);
}
$karmasent['skills'] = $userSentSkills;
$karmasent['req_id'] = $sent['req_id'];
$karmasent['req_detail'] = Meetingrequest::find($sent['req_id'])->toArray();
$karmasent['status'] = $sent['statusreceiver'];
$karmasent['created_at'] = date('F d, Y', strtotime($sent['created_at']));
$karmaSentUser[] = $karmasent;
}
//.........这里部分代码省略.........
示例8: inviteOnkc
public function inviteOnkc($giver_id)
{
$user_info = Auth::user();
$giver_info = Connection::find($giver_id);
$receiver_vanity_url = KarmaHelper::getVanityURL($user_info->id);
$checkMsgLimit = KarmaHelper::CheckUserLinkedMgsLimit();
return View::make('invite_onkc', array('pageTitle' => 'KarmaCircles Invite', 'checkMsgLimit' => $checkMsgLimit, 'CurrentUser' => $user_info, 'GiverInfo' => $giver_info, 'receiver_vanity_url' => $receiver_vanity_url));
}