本文整理汇总了PHP中app\Member::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::orderBy方法的具体用法?PHP Member::orderBy怎么用?PHP Member::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::orderBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showHomePage
public function showHomePage(Request $r)
{
$var = $this->getVars();
$content = array();
$content["services"] = Content::where('type', '=', 'services')->get();
$content["fields"] = Content::where('type', '=', 'fields')->get();
$events = Event::get();
$content["blogs"] = Content::where('type', '=', 'blogs')->orderBy("date_created", "desc")->take(3)->get();
$content["members"] = Member::orderBy('position', 'desc')->get();
$content["didactics"] = Content::where('type', '=', 'didactics')->orderBy("date_created", "desc")->take(3)->get();
$content["resources"] = Content::where('type', '=', 'resources')->orderBy("date_created", "desc")->take(3)->get();
$content["galleries"] = Content::where('type', '=', 'galleries')->orderBy("date_created", "desc")->take(3)->get();
$content["companies"] = Content::where('type', '=', 'companies')->orderBy("date_created", "desc")->get();
$content["researchesours"] = Content::where('type', '=', 'researches')->whereHas('research', function ($query) {
$query->where('external', 0);
})->orderBy("date_created", "desc")->take(2)->get();
$content["researchesexternal"] = Content::where('type', '=', 'researches')->whereHas('research', function ($query) {
$query->where('external', 1);
})->orderBy("date_created", "desc")->take(2)->get();
$services = Content::where('type', '=', 'services')->get();
// dd($content);
$lang = $r->session()->get("lang", "fa");
// if($lang == "en")
// return view("testhome",["content" => $content, "var" => $var, "lang" => $lang]);
return view('home', ["content" => $content, "var" => $var, "lang" => $lang]);
}
示例2: getMembers
/**
* Display the member statistics
*
* Will return JSON mapping date => number of users who registered on date.
* Note: Return JSON should have dates in order, but not guaranteed.
*
* @return Response
*/
public function getMembers()
{
$result = [];
$members = Member::orderBy('created_at', 'asc')->get(['created_at']);
foreach ($members as $member) {
// Make a frequency array mapping date=>frequency
$date = $member->created_at->format('d/m/Y');
if (array_key_exists($date, $result)) {
$result[$date]++;
} else {
$result[$date] = 1;
}
}
return response()->json($result);
}
示例3: schedule
public function schedule()
{
$mems = Member::orderBy('lname')->get();
$totals = array(0, 0, 0, 0, 0, 0, 0);
foreach ($mems as $mem) {
$bal = 0.0;
//dd($bal = $mem->accounts->where('loan_id',1)->first()->balance);
$totals[0] += !empty($mem->accounts->where('loan_id', 1)->first()->balance) ? $mem->accounts->where('loan_id', 1)->first()->balance : 0.0;
$totals[1] += !empty($mem->accounts->where('loan_id', 2)->first()->balance) ? $mem->accounts->where('loan_id', 2)->first()->balance : 0.0;
$totals[2] += !empty($mem->accounts->where('loan_id', 3)->first()->balance) ? $mem->accounts->where('loan_id', 3)->first()->balance : 0.0;
$totals[3] += !empty($mem->accounts->where('loan_id', 4)->first()->balance) ? $mem->accounts->where('loan_id', 4)->first()->balance : 0.0;
$totals[4] += !empty($mem->accounts->where('loan_id', 5)->first()->balance) ? $mem->accounts->where('loan_id', 5)->first()->balance : 0.0;
$totals[5] += !empty($mem->accounts->where('loan_id', 6)->first()->balance) ? $mem->accounts->where('loan_id', 6)->first()->balance : 0.0;
$totals[6] += !empty($mem->accounts->where('loan_id', 7)->first()->balance) ? $mem->accounts->where('loan_id', 7)->first()->balance : 0.0;
}
/*foreach($mem->accounts as $acc){
$acc->balance
}*/
return \PDF::loadHTML(view('reports.report2', compact('mems', 'totals')))->setOrientation('landscape')->stream('test.pdf');
//return view('reports.report1');
}
示例4: index
public function index(Request $request)
{
$members = \App\Member::orderBy('created_at', 'asc')->get();
return view('members', ['members' => $members]);
}
示例5: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$appli = Member::orderBy('lName')->get();
return view('admin.member.index', compact('appli'));
}
示例6: gatherMembers
/**
* Gathers all the info needed by a reading in one array (so that the view doesn't have to
* make database requests)
*
* @param $votingItems The voting items of a voting, as returned by the gatherVotingItems() function
* @param $votingId The voting id of the voting
* @return array The array needed by the readings view
*/
private function gatherMembers($votingItems, $votingId)
{
$members = Member::orderBy('district_id')->orderBy('order')->get();
$myMembers = [];
foreach ($members as $member) {
$m = [];
// Id and full name
$m['id'] = $member->id;
$m['full_name'] = $member->first_name . ' ' . $member->last_name;
// Add default properties to show state of member
$m['isSaved'] = 'true';
$m['isAbsent'] = 'false';
$m['labels'] = [];
// Gather default answers for each voting item
$answerIds = [];
foreach ($votingItems as $vi) {
$vItemId = $vi['id'];
$answerIds[$vItemId] = $member->vote($votingId, $vItemId);
// If member has voted already, the answer will be returned
$m['labels'][$vItemId] = '';
// Initialize label as nothing (will be changed afterwards)
}
$m['answerIds'] = $answerIds;
$tmpAnswerId = reset($m['answerIds']);
// reset() returns the first value of the array
if ($tmpAnswerId == null) {
// Member has not voted or is saved as absent
if ($tmpAnswerId === null) {
$m['isSaved'] = 'false';
// If answer id is indeed NULL, then the member has not voted at all in this voting
} else {
$m['isAbsent'] = 'true';
// If it is not NULL, then it is '', so the member was absent!!!
}
// For each voting item in this voting, get this member's default group answer
foreach ($votingItems as $vi) {
$vItemId = $vi['id'];
// Get default group answer
$tmpAnswer = $member->groupAnswer($votingId, $vItemId);
// If it's null (which means the member isn't in any groups) then select the first answer
if ($tmpAnswer == null) {
$tmpAnswer = $vi['answers'][1];
}
$m['answerIds'][$vItemId] = $tmpAnswer;
}
} else {
// For each voting item, get the member's answer id and find that answer's text and put it in the labels array
foreach ($votingItems as $vi) {
$vItemId = $vi['id'];
// This voting item's id
$answerId = $m['answerIds'][$vItemId];
// The member's answer id
$answerText = $vi['answers'][$answerId];
// The text of the member's answer
$m['labels'][$vItemId] = $answerText;
}
}
$myMembers[] = $m;
}
return $myMembers;
}
示例7: index
public function index()
{
$members = Member::orderBy('created_at', 'DEC')->get();
return view('member.index')->with('members', $members);
}