public function index() { $labs = Labs::all(); /* $feature = []; $subjects = Subjects::all(); foreach ($subjects as $one) { $rel = SubjectsLabs::select('*') ->where('subject_id', $one->id)->get(); $lab_feature = [ 'id' => -1, 'qtd' => 0 ]; foreach ($rel as $r) { $n = Log::where(['lab_id' => $r->lab_id])->count(); if ($n > $lab_feature['qtd']) { $lab_feature['id'] = $r->lab_id; $lab_feature['qtd'] = $n; } } if ($lab_feature['id'] >= 0) $feature[$one->name] = Labs::find($lab_feature['id']); } */ $users = DB::table('users')->get(); $category_id = App::getLocale() == 'pt' ? 5 : 2; $all_courses = array_map(function ($item) { return (array) $item; }, DB::connection('moodle')->table('mdl_course')->where('category', $category_id)->where('visible', '1')->get()); $courses = []; $qtd = 5 <= count($all_courses) ? '5' : count($all_courses); $nums = []; $i = 0; do { //$rand = rand(0, $qtd - 1); // if (!array_search($rand, $courses)) { array_push($courses, $all_courses[$i]); $i++; //} } while ($i < $qtd); return view('home', ['labs' => $labs, 'courses' => $courses]); }
<?php use App\Labs; $lab = Labs::find($exp); $troca = $rpijson['dados']; ?> <header> <div > <img src='img/report/header.png' style="width: 100%; "> </div> </header> <img src="img/report/line.png" style="height:3000px; width:14px; margin-top: 138px; position: fixed; left:0; "> <div class="info"> <h3 class="title">Relatório de Prática Experimental</h3> @if (Auth::check()) <div class="infnames"> <p><b>Nome:</b> {{ Auth::user()->firstname }} {{ Auth::user()->lastname }} </p> <p><b>Experimento:</b> {{ $lab->name_pt }} </p> <p><b>Data:</b> <?php echo date('d/m/Y'); ?> </p> </div> <div class="infnames2"> <p><b>Instituição:</b> {{ Auth::user()->organization }}</p> <p><b>Email:</b> {{ Auth::user()->email }} </p> </div>
/** * @return \Illuminate\View\View */ function moodle() { $id = Route::getCurrentRoute()->parameters(); $exp = Labs::find($id)[0]; $exp['lang'] = App::getLocale(); return view('labs.moodle', compact('exp')); }
<th>{{trans('log.browser')}}</th> <th>{{trans('log.mobile')}}</th> <th>{{trans('log.language')}}</th> <th>{{trans('log.country')}}</th> <th>{{trans('log.city')}}</th> </tr> </thead> <tbody> @foreach($logs as $log) <tr> <?php $idExp = $log->lab_id; $lab = Labs::find($idExp); if ($log->user_id) { $idUser = $log->user_id; $user = User::find($idUser); } else { $user['username'] = '******'; } $locale = 'name_' . App::getlocale(); $name = ""; if ($log->mobile == "1") { $name = trans('log.true'); } else { $name = trans('log.false'); } ?>