本文整理汇总了PHP中Contest::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Contest::where方法的具体用法?PHP Contest::where怎么用?PHP Contest::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contest
的用法示例。
在下文中一共展示了Contest::where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// $this->layout->content =
if (Sentry::getUser()->hasPermission('admin')) {
return View::make('dashboard.indexadmin')->withtitle("Dashboard Admin");
} elseif (Sentry::getUser()->hasPermission('panitia')) {
return View::make('dashboard.indexadmin')->withtitle("Dashboard Panitia");
} elseif (Sentry::getUser()->hasPermission('user')) {
$menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
$jenjang = Sentry::getUser()->last_name;
if ($jenjang === 'SMA') {
$runpas = Contest::where('nocontest', 'Lari 100m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$runpis = Contest::where('nocontest', 'Lari 100m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$juma = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$jumpa = $runpas + $ljpas + $tppas + $ltpas;
$jumpi = $runpis + $ljpis + $tppis + $ltpis;
return View::make('dashboard.indexuser')->withtitle("Dashboard User")->with('menu', $menu)->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('juma', $juma)->with('jumpa', $jumpa)->with('jumpi', $jumpi);
} elseif ($jenjang === 'SMP') {
$runpas = Contest::where('nocontest', 'Lari 60m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$runpis = Contest::where('nocontest', 'Lari 60m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$juma = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$jumpa = $runpas + $ljpas + $tppas + $ltpas;
$jumpi = $runpis + $ljpis + $tppis + $ltpis;
return View::make('dashboard.indexuser')->withtitle("Dashboard User")->with('menu', $menu)->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('juma', $juma)->with('jumpa', $jumpa)->with('jumpi', $jumpi);
} elseif ($jenjang === 'SD') {
$runpas = Contest::where('nocontest', 'Lari 50m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$runpis = Contest::where('nocontest', 'Lari 50m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$lbpas = Contest::where('nocontest', 'Lempar Bola pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$lbpis = Contest::where('nocontest', 'Lempar Bola pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$lespa = Contest::where('nocontest', 'Lari Estafet pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$lespi = Contest::where('nocontest', 'Lari Estafet pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$juma = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->count();
$jumpa = $runpas + $ljpas + $lbpas + $lespa;
$jumpi = $runpis + $ljpis + $lbpis + $lespi;
return View::make('dashboard.indexuser')->withtitle("Dashboard User")->with('menu', $menu)->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('lbpas', $lbpas)->with('lbpis', $lbpis)->with('lespa', $lespa)->with('lespi', $lespi)->with('juma', $juma)->with('jumpa', $jumpa)->with('jumpi', $jumpi);
}
}
}
示例2: create2
public function create2($id)
{
$menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
$menus = Menu::find($id);
$date = \Carbon\Carbon::now();
$thn = date('Y');
$tgl = new DateTime(date('Y-m-d'));
$limit = Setting::first();
$limitdtstart = new DateTime($limit->startdayreg);
$limitdtend = new DateTime($limit->enddayreg);
$limitstart = $limitdtstart->diff($tgl)->format('%R%a');
$limitend = $limitdtend->diff($tgl)->format('%R%a');
$contest = Contest::where('nocontest', $menus->menu)->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', $thn)->count();
// dd($limitend);
if ($limitstart < 0) {
return Redirect::route('user.contests.index')->with('errorMessage', trans('Pendaftaran Lomba Belum Dibuka.'));
}
if ($limitend > 0) {
return Redirect::route('user.contests.index')->with('errorMessage', trans('Pendaftaran Lomba Sudah Ditutup.'));
}
if ($contest < 2) {
return View::make('contests.create')->withTitle('Estafet')->with('menu', $menu)->with('menus', $menus);
} else {
if ($menus->menu == 'Lari Estafet pa' and $contest < 8) {
return View::make('contests.create')->withTitle('Estafet')->with('menu', $menu)->with('menus', $menus);
} else {
if ($menus->menu == 'Lari Estafet pi' and $contest < 8) {
return View::make('contests.create')->withTitle('Estafet')->with('menu', $menu)->with('menus', $menus);
} else {
return Redirect::route('user.contests.index')->with('errorMessage', trans('Lomba sudah penuh.'));
}
}
}
}
示例3: exportseratlet
public function exportseratlet()
{
Session::put('sattahun', Input::get('tahun'));
Session::put('satjenjang', Input::get('jenjang'));
$seratlets = Contest::where('tahun', Session::get('sattahun'))->where('jenjang', Session::get('satjenjang'))->where('verifikasi', '1')->where('nodada', '!=', '')->where('sertifikat', '1')->orderBy('user_id', 'asc')->get();
return $this->exportExcelseratlet($seratlets);
}
示例4: invoice
public function invoice()
{
$jenjang = Sentry::getUser()->last_name;
$cost = Setting::first();
$school = School::where('user_id', Sentry::getUser()->id)->first();
$payment = Payment::where('user_id', Sentry::getUser()->id)->where(DB::raw('year'), '=', date('Y'))->first();
if ($jenjang === 'SMA') {
$runpas = Contest::where('nocontest', 'Lari 100m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$runpis = Contest::where('nocontest', 'Lari 100m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
$sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
$book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
$jrunpas = $runpas * $cost->moneyreg;
$jrunpis = $runpis * $cost->moneyreg;
$jljpas = $ljpas * $cost->moneyreg;
$jljpis = $ljpis * $cost->moneyreg;
$jtppas = $tppas * $cost->moneyreg;
$jtppis = $tppis * $cost->moneyreg;
$jltpas = $ltpas * $cost->moneyreg;
$jltpis = $ltpis * $cost->moneyreg;
$jsertatl = $sertatl * $cost->moneysertatl;
$jsertoff = $sertoff * $cost->moneysertoff;
$jbook = $book * $cost->moneydocbook;
$jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis + $jsertatl + $jsertoff + $jbook;
return View::make('costs.invoice2')->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jtppas', $jtppas)->with('jtppis', $jtppis)->with('jltpas', $jltpas)->with('jltpis', $jltpis)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
} elseif ($jenjang === 'SMP') {
$runpas = Contest::where('nocontest', 'Lari 60m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$runpis = Contest::where('nocontest', 'Lari 60m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$tppas = Contest::where('nocontest', 'Tolak Peluru pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$tppis = Contest::where('nocontest', 'Tolak Peluru pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ltpas = Contest::where('nocontest', 'Lompat Tinggi pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ltpis = Contest::where('nocontest', 'Lompat Tinggi pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
$sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
$book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
$jrunpas = $runpas * $cost->moneyreg;
$jrunpis = $runpis * $cost->moneyreg;
$jljpas = $ljpas * $cost->moneyreg;
$jljpis = $ljpis * $cost->moneyreg;
$jtppas = $tppas * $cost->moneyreg;
$jtppis = $tppis * $cost->moneyreg;
$jltpas = $ltpas * $cost->moneyreg;
$jltpis = $ltpis * $cost->moneyreg;
$jsertatl = $sertatl * $cost->moneysertatl;
$jsertoff = $sertoff * $cost->moneysertoff;
$jbook = $book * $cost->moneydocbook;
$jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jtppas + $jtppis + $jltpas + $jltpis + $jsertatl + $jsertoff + $jbook;
return View::make('costs.invoice2')->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('tppas', $tppas)->with('tppis', $tppis)->with('ltpas', $ltpas)->with('ltpis', $ltpis)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jtppas', $jtppas)->with('jtppis', $jtppis)->with('jltpas', $jltpas)->with('jltpis', $jltpis)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
} elseif ($jenjang === 'SD') {
$runpas = Contest::where('nocontest', 'Lari 50m pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$runpis = Contest::where('nocontest', 'Lari 50m pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ljpas = Contest::where('nocontest', 'Lompat Jauh pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$ljpis = Contest::where('nocontest', 'Lompat Jauh pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$lbpas = Contest::where('nocontest', 'Lempar Bola pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$lbpis = Contest::where('nocontest', 'Lempar Bola pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$lespa = Contest::where('nocontest', 'Lari Estafet pa')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$lespi = Contest::where('nocontest', 'Lari Estafet pi')->where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->count();
$sertatl = Contest::where('user_id', Sentry::getUser()->id)->where(DB::raw('tahun'), '=', date('Y'))->where('verifikasi', 1)->whereNotNull('nodada')->where('sertifikat', 1)->count();
$sertoff = Officer::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('sertifikat', 1)->count();
$book = Docbook::where('user_id', Sentry::getUser()->id)->where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where('docbook', 1)->count();
$jrunpas = $runpas * $cost->moneyreg;
$jrunpis = $runpis * $cost->moneyreg;
$jljpas = $ljpas * $cost->moneyreg;
$jljpis = $ljpis * $cost->moneyreg;
$jlbpas = $lbpas * $cost->moneyreg;
$jlbpis = $lbpis * $cost->moneyreg;
if ($lespa % 8 == 0) {
$lespa = $lespa / 8;
$jlespa = $lespa * $cost->moneyregest;
} else {
$lespa = 0;
$jlespa = $lespa * $cost->moneyregest;
}
if ($lespi % 8 == 0) {
$lespi = $lespi / 8;
$jlespi = $lespi * $cost->moneyregest;
} else {
$lespi = 0;
$jlespi = $lespi * $cost->moneyregest;
}
$jsertatl = $sertatl * $cost->moneysertatl;
$jsertoff = $sertoff * $cost->moneysertoff;
$jbook = $book * $cost->moneydocbook;
$jtotal = $jrunpas + $jrunpis + $jljpas + $jljpis + $jlbpas + $jlbpis + $jlespa + $jlespi + $jsertatl + $jsertoff + $jbook;
return View::make('costs.invoice2')->with('runpas', $runpas)->with('runpis', $runpis)->with('ljpas', $ljpas)->with('ljpis', $ljpis)->with('lbpas', $lbpas)->with('lbpis', $lbpis)->with('lespa', $lespa)->with('lespi', $lespi)->with('sertatl', $sertatl)->with('sertoff', $sertoff)->with('book', $book)->with('jrunpas', $jrunpas)->with('jrunpis', $jrunpis)->with('jljpas', $jljpas)->with('jljpis', $jljpis)->with('jlbpas', $jlbpas)->with('jlbpis', $jlbpis)->with('jlespa', $jlespa)->with('jlespi', $jlespi)->with('jsertatl', $jsertatl)->with('jsertoff', $jsertoff)->with('jbook', $jbook)->with('jtotal', $jtotal)->with('cost', $cost)->with('school', $school)->with('payment', $payment);
}
}
示例5: validasi
public function validasi($id)
{
//Start - update status validasi
$payment = Payment::findOrFail($id);
$data['verifikasi'] = 1;
$payment->update($data);
//End - upate status validasi
//Start - ambil data atlit yang sudah terverifikasi berdasarkan tahun
$getatlit = Contest::where('user_id', $payment->user_id)->where('tahun', date('Y'))->where('verifikasi', '1')->get();
//End - ambil data atlit yang sudah terverifikasi berdasarkan tahun
//Start - ambil jumlah data atlit yang sudah terverifikasi berdasarkan tahun
$getsumatlit = Contest::where('user_id', $payment->user_id)->where('tahun', date('Y'))->where('verifikasi', '1')->count();
//End - ambil jumlah data atlit yang sudah terverifikasi berdasarkan tahun
//Start - lihat jenjang dari bukti pembayaran
$jenjang = Payment::where('id', $id)->with('Akun')->first();
//End - lihat jenjang dari bukti pembayaran
for ($i = 0; $i < $getsumatlit; $i++) {
//Start - Ambil urutan nomor dada sesuai jenjang
$posno = Sequent::where('jenjang', $jenjang->Akun->last_name)->first();
$nodadanow = $posno->number + 1;
//End - Ambil urutan nomor dada sesuai jenjang
//Start - Ambil 1 altit yang akan diberikan nomor dengan mengambil id
$getatlit = Contest::where('user_id', $payment->user_id)->where('tahun', date('Y'))->where('verifikasi', '1')->skip($i)->take(1)->first();
$getidatlit = $getatlit->id;
//End - Ambil 1 altit yang akan diberikan nomor dengan mengambil id
//Start - Update atlit dengan memberi nomor dada
$contest = Contest::findOrFail($getidatlit);
$nodada['nodada'] = str_pad($nodadanow, 3, '0', STR_PAD_LEFT);
$contest->update($nodada);
//End - Update atlit dengan memberi nomor dada
//Start - Update nomer pada table sequent
$sequent = Sequent::findOrFail($posno->id);
$datano['number'] = $nodadanow;
$sequent->update($datano);
//End - Update nomer pada table sequent
}
return Redirect::to('admin/valid' . '?statvalid=' . Session::get('statusvalid'))->with("successMessage", "Berhasil divalidasi");
}