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]); }
/** * 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); }
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'); }
public function index(Request $request) { $members = \App\Member::orderBy('created_at', 'asc')->get(); return view('members', ['members' => $members]); }
/** * 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')); }
/** * 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; }
public function index() { $members = Member::orderBy('created_at', 'DEC')->get(); return view('member.index')->with('members', $members); }