public static function PromotionCase() { $status = PromotionStatus::where('user_id', \Auth::user()->id)->where('global', 1)->first(); if ($status) { return true; } else { return false; } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $aboutfacture = SchoolYear::checkNextMonth(); PromotionStatus::fillStatusesFirst(); $client = new Google_Client(); $client->setClientId('548520090024-i8jmtdmdi5ijvj3mn2sbqe2u3a431gh6.apps.googleusercontent.com'); $client->setClientSecret('IX-SilXd0ctCrKUX1a5oP9is'); $client->setRedirectUri('http://laravel.dev:8000/schools/boite'); $client->addScope('https://mail.google.com'); $service = new Google_Service_Gmail($client); $count = Attendance::whereRaw('EXTRACT(year from start) = ?', [Carbon::now()->year])->whereRaw('EXTRACT(month from start) = ?', [Carbon::now()->month])->whereRaw('EXTRACT(day from start) = ?', [Carbon::now()->day])->where('user_id', \Auth::user()->id)->groupBy('child_id')->get(); $count = $count->count(); return view('index')->with(['client' => $client, 'service' => $service, 'count' => $count, 'aboutfacture' => $aboutfacture]); }
<div class="fileupload-preview fileupload-exists thumbnail "></div> <div class="btn_upload"> <span class="btn btn-white btn-file"> <span class="fileupload-new"><i class="fa fa-paper-clip"></i> Sélectionner une image </span> <span class="fileupload-exists"><i class="fa fa-undo"></i> Changer</span> <input type="file" class="default" name="photo" id="uploadFile" /> </span> </div> </div> </div> </div> </section> <!-- 3 links nav --> <?php $status = \App\PromotionStatus::PromotionCase(); ?> @if($status) <section class="panel"> <a href="{{ action('SchoolsController@promotion',[\Auth::user()->id]) }}"> <div class="panel-body promotion"> <img src="{{ asset('images/promotion.png') }}"><span>Promotion activée</span> </div></a> </section> @else <section class="panel"> <a href="{{ action('SchoolsController@promotion',[\Auth::user()->id]) }}"> <div class="panel-body promotion_inactif"> <img src="{{ asset('images/promotion.png') }}"><span>Promotion désactivée</span>
public function checkbloc2() { if (\Request::ajax()) { $global_status = PromotionStatus::where('user_id', \Auth::user()->id)->first(); if ($global_status->bloc2 == 1) { echo 'on'; } } }