当前位置: 首页>>代码示例>>PHP>>正文


PHP School::where方法代码示例

本文整理汇总了PHP中School::where方法的典型用法代码示例。如果您正苦于以下问题:PHP School::where方法的具体用法?PHP School::where怎么用?PHP School::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在School的用法示例。


在下文中一共展示了School::where方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $menu = Menu::where('tipe', Sentry::getUser()->last_name)->get();
     $school = School::where('user_id', Sentry::getUser()->id)->first();
     $profile = School::find($school->id);
     return View::make('profile.index', compact('profile'))->withTitle('Profile')->with('menu', $menu);
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:12,代码来源:ProfileController.php

示例2: boot

 protected static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $data = array('municipality_id' => $model->municipality_id, 'name' => $model->name);
         $rules = array('municipality_id' => 'required|integer|min:1|max:300000', 'name' => 'required|min:3|max:50');
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             throw new ValidationException(null, null, null, $validator->messages());
         } else {
             return $model->validate();
         }
     });
     static::updating(function ($model) {
         $data = array('municipality_id' => $model->municipality_id, 'name' => $model->name);
         $rules = array('municipality_id' => 'required|integer|min:1|max:300000', 'name' => 'required|min:3|max:50');
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             throw new ValidationException(null, null, null, $validator->messages());
         } else {
             return true;
         }
     });
     static::deleting(function ($model) {
         $schools = School::where('city_id', '=', $model->id)->get();
         foreach ($schools as $school) {
             $school = School::find($school->id)->delete();
         }
         return true;
     });
 }
开发者ID:mertindervish,项目名称:registerbg,代码行数:31,代码来源:City.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($schoolName, $surveyName, $groupName)
 {
     if (Auth::check()) {
         $user = Auth::user();
     } else {
         return Redirect::back();
     }
     if ($user->group->name != $groupName) {
         return Redirect::back();
     }
     $school = School::where('name', '=', $schoolName)->first();
     $survey = $school->surveys()->where('name', $surveyName)->first();
     $group = $survey->groups()->where('name', $groupName)->first();
     if (strtotime($group->pivot->close_time) < time()) {
         return Redirect::back()->with('state', 'error')->with('error', 'You can no longer edit and save your answers. The survey has closed and your edits have been discarded.');
     }
     //Store a filled out survey. This is when the user clicks the submit button.
     foreach (Input::all() as $origMark => $answer) {
         $answers[$origMark] = $answer;
     }
     unset($answers['_token']);
     $path = app_path() . "/answers/{$user->id}.ans";
     if (File::exists($path)) {
         $answerStore = json_decode(File::get($path), true);
     }
     $answerStore[$user->id] = $answers;
     File::put($path, json_encode($answerStore));
     return Redirect::back();
 }
开发者ID:AlexLeung,项目名称:ibsurvey,代码行数:34,代码来源:GroupsController.php

示例4:

    <section class="content">
        @if(isset($schools))
            <div class="row">
                <div class="col-sm-3">
                    <h4>Offline: {{ User::where('city_id',$city)->where('paid',1)->count() }}</h4>
                </div>
                <div class="col-sm-3">
                    <h4>Online: {{ User::where('centre_city',$city.'0')->where('paid',0)->count() }}</h4>
                </div>
                <div class="col-sm-3">
                    <h4>Collected in Summer: {{ User::where('city_id',$city)->where('paid',1)->where('status',1)->count() }}</h4>
                </div>
            </div>
            @foreach($schools as $school_id)
                <?php 
$school = School::where('id', $school_id['school_id'])->first();
?>
                <div class="row">
                    <div class="col-md-12">
                        <div class="box box-default collapsed-box">
                            <div class="box-header">
                                <h3 class="box-title">{{ $school->name }}  (Regs: {{ User::where('school_id',$school->id)->where('paid',1)->count() }})</h3>
                                <div class="box-tools pull-right">
                                    <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
                                </div>
                            </div>
                            <div class="box-body table-responsive" style="display: none">
                                <table id="{{ $school->id }}" class="table table-bordered table-striped table-hover dataTable school">
                                    <thead>
                                    <tr>
                                        <th>Name 1</th>
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:31,代码来源:registrations.blade.php

示例5: loadSchools

 public function loadSchools($name)
 {
     $schools = School::where('name', 'like', "%{$name}%")->take(5)->get();
     return $schools->toJson();
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:5,代码来源:AjaxesController.php

示例6: 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);
     }
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:95,代码来源:CostController.php

示例7: destroy

 /**
  * Remove the specified school from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $sekolah = School::where('id', $id)->first();
     // User::where('id', $sekolah->user_id)->delete($id);
     $data['activated'] = 0;
     User::where('id', $sekolah->user_id)->update($data);
     School::destroy($id);
     return Redirect::route('admin.daftarsekolah')->with('successMessage', 'Sekolah berhasil dihapus');
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:15,代码来源:SchoolsController.php

示例8: test

 public function test()
 {
     $output = '<table>';
     foreach (Centre::all() as $centre) {
         $output .= '<tr><td>' . $centre->name . '</td><td>' . $centre->address . '</td><td>' . $centre->city->name . '</td><td>' . $centre->city->state->name . '</td><td>' . $centre->pincode . '</td></tr>';
     }
     $output .= '</table>';
     return $output;
     return PDF::loadView('admin.certi')->stream('certi_final.pdf');
     //        return View::make('admin.centrecerti');
     //        $pdf = PDF::loadView('admin.centrecerti');
     //        return $pdf->stream('certi.pdf');
     $out = '<table>';
     $out .= '<tr><td>Name</td><td>Address</td><td>City</td><td>Pincode</td></tr>';
     $count = 0;
     foreach (Centre::orderBy('city_id')->get() as $centre) {
         $out .= '<tr><td>' . $centre->name . '</td><td>' . $centre->address . '</td><td>' . $centre->city->name . '</td><td>' . $centre->pincode . '</td></tr>';
     }
     //        foreach (DB::table('results_2015')->where('rank','<','51')->where('kv',1)->get() as $user)
     //        {
     //            if(User::where('roll',$user->roll)->count()) {
     //                $users = User::where('roll',$user->roll)->first();
     //                if($users->status == 3 || $users->status == 5) {
     ////                    dd($users);
     //                    $out .= '<tr><td>'.$user->rank.'</td><td>'.$user->roll.'</td><td>'.$user->mobile.'</td><td>'.$users->name1.'</td><td>'.$users->name2.'</td><td>'.$user->path.'</td><td></td><td></td><td></td><td></td><td></td><td></td><td>'.$users->squad.'</td></tr>';
     //                }
     //                else {
     //                    try {
     //                        $out .= '<tr><td>'.$user->rank.'</td><td>'.$user->roll.'</td><td>'.$user->mobile.'</td><td>'.$users->name1.'</td><td>'.$users->name2.'</td><td>'.$users->school->name.'</td><td>'.$users->city->name.'</td><td>'.$users->school->address.'</td><td>'.$users->school->pincode.'</td><td>'.$users->school->contact.'</td><td>'.$users->contact1.'</td><td>'.$users->contact2.'</td><td>'.$users->squad.'</td></tr>';
     //                    }catch (Exception $e) {
     //                        return var_dump($users);
     //                    }
     //                }
     ////                $count++;
     //            }
     //        }
     //        return $count;
     return $out . '</table>';
     $pdf = PDF::loadView('admin.certi');
     return $pdf->stream('certi.pdf');
     $det = '<table>';
     foreach (City::orderBy('state_id')->get() as $city) {
         $count = User::whereCityId($city->id)->count();
         if ($count) {
             $det .= '<tr><td>' . $city->name . '</td><td>' . $city->state->name . '</td><td>' . $count . '</td></tr>';
         }
     }
     $det .= '</table>';
     return $det;
     //        $list = '<table>';
     //        foreach(DB::table('results_2015')->where('rank','<','27')->where('kv','!=',1)->where('roll','LIKE',"H%")->get() as $res)
     //        {
     //            $user = User::whereRoll($res->roll)->first();
     //            if(!$user) {
     //                $name1 = 'User1';
     //                $name2 = 'User2';
     //            }
     //            else {
     //                $name1 = $user->name1;
     //                $name2 = $user->name2;
     //            }
     //            $list .= '<tr><td>'.$res->rank.'</td><td>'.$res->roll.'</td><td>'.$name1.'</td><td>'.$name2.'</td><td>'.$res->mobile.'</td><td>'.$res->path.'</td></tr>';
     //        }
     //        $list .= '</table>';
     //        return $list;
     //        $rolls = array('HE53600040','HE53600004','HE53600027','HE53600022','HE53600023','HE53600002','HE53600005','HE53600003','HE53600006','HE53600034','HE53600033','HE53600037','HE53600001','HE53600039','HE53600038','HE53600018','HE53600011','HE53600010','HE53600009','HE53600008','HE53600007','HE53600025','HE53600026','HE53600020','HE53600019','HE53600016','HE53600017','HE53600015','HE53600014','HE53600013','HE53600012');
     //        $list = '';
     //        foreach($rolls as $roll)
     //        {
     //            $old = User::whereRoll($roll)->first();
     //            $user = $old->replicate();
     //            $user->squad = 'JUNIOR';
     //            $lastroll = User::withTrashed()->where('roll', 'LIKE', "%JE5360%")->count();
     //            $roll = 'JE5360'.str_pad(strval($lastroll + 1), 4, "0", STR_PAD_LEFT);
     //            $user->roll = $roll;
     //            $user->comments = 'Change squad';
     //            $user->push();
     //            $list .= $old->roll.'  '.$user->roll.'<br>';
     //        }
     //        return $list;
     $user = User::whereRoll('HE52530018')->first();
     return $user->roll . '<br>' . Crypt::decrypt($user->result_pass) . '<br>' . $user->name1 . '<br>' . $user->name2;
     foreach (User::where('city_id', 21)->where('paid', 1)->get() as $user) {
         $password = str_random(6);
         $school = $user->school;
         $user->password = Hash::make($password);
         $user->save();
         if ($user->email1 !== "") {
             Queue::push(function ($job) use($user, $password, $school) {
                 Mail::send('emails.offline', array('user' => $user, 'school' => $school, 'password' => $password, 'name' => $user->name1), function ($message) use($user) {
                     $message->to($user->email1, $user->name1)->subject('Technothlon Registration Details');
                 });
                 $job->delete;
             });
         }
         if ($user->email1 !== "") {
             Queue::push(function ($job) use($user, $password, $school) {
                 Mail::send('emails.offline', array('user' => $user, 'school' => $school, 'password' => $password, 'name' => $user->name2), function ($message) use($user) {
                     $message->to($user->email2, $user->name2)->subject('Technothlon Registration Details');
                 });
//.........这里部分代码省略.........
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:101,代码来源:AdminController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($schoolName, $surveyName)
 {
     if (!Auth::check() || Auth::user()->group->name != "Admin") {
         return Redirect::back();
     }
     //We need to figure out what kind of post we are getting.
     $school = School::where('name', '=', $schoolName)->first();
     $survey = $school->surveys()->where('name', $surveyName)->first();
     $name = Input::get('name');
     $questions = Input::get('questions');
     $rules = array('name' => 'required|alpha_num');
     $fields['questions'] = NULL;
     $validator;
     if (Input::has('changeName')) {
         $fields['name'] = $name;
         $validator = Validator::make($fields, $rules);
         if (!$validator->fails()) {
             if (is_null($school->surveys()->where('name', $fields['name'])->first())) {
                 $survey->name = $fields['name'];
                 $survey->save();
                 return Redirect::to("/schools/{$school->name}/{$survey->name}")->withInput(array('questions' => $questions));
             } else {
                 $fields['name'] = "{$fields['name']} already exists under {$school->name}.";
             }
         }
     } else {
         if (Input::has('changeQuestions')) {
             $fields['questions'] = Survey::parseQuestionStore($questions, $school->id);
             if ($fields['questions'][0]) {
                 File::put(app_path() . "/questions/{$survey->id}.qs", $questions);
             }
             $validator = Validator::make(array('name' => 'present'), $rules);
         } else {
             $fields = array('time' => 'Default');
             $rules = array('time' => 'required');
             $submitName = '';
             $fieldName = '';
             $group = NULL;
             foreach ($school->groups as $potentialGroup) {
                 if (Input::has("{$potentialGroup->name}ChangeOpen")) {
                     $submitName = 'ChangeOpen';
                     $fieldName = 'openTime';
                     $group = $potentialGroup;
                     break;
                 } else {
                     if (Input::has("{$potentialGroup->name}OpenNow")) {
                         $submitName = 'OpenNow';
                         $group = $potentialGroup;
                         break;
                     } else {
                         if (Input::has("{$potentialGroup->name}ChangeClose")) {
                             $submitName = 'ChangeClose';
                             $fieldName = 'closingTime';
                             $group = $potentialGroup;
                             break;
                         } else {
                             if (Input::has("{$potentialGroup->name}CloseNow")) {
                                 $submitName = 'CloseNow';
                                 $group = $potentialGroup;
                                 break;
                             }
                         }
                     }
                 }
             }
             if (strpos($submitName, 'Change') === 0) {
                 $fields['time'] = Input::get("{$fieldName}{$group->name}");
                 $rules['time'] = 'required|date_format:Y-m-d H:i:s';
             } else {
                 $now = date("Y-m-d H:i:s");
                 $later = date("Y-m-d H:i:s", time() + 365 * 24 * 60 * 60);
             }
             $validator = Validator::make($fields, $rules);
             if ($validator->fails()) {
                 $fields['time'] = "{$fieldName}{$group->name}";
             } else {
                 if (!$group->surveys->contains($survey->id)) {
                     $group->surveys()->attach($survey->id);
                 }
                 $group = $survey->groups()->where('group_id', $group->id)->first();
                 switch ($submitName) {
                     case 'ChangeOpen':
                         $group->pivot->open_time = $fields['time'];
                         break;
                     case 'ChangeClose':
                         $group->pivot->close_time = $fields['time'];
                         break;
                     case 'OpenNow':
                         $group->pivot->open_time = $now;
                         $group->pivot->close_time = $later;
                         break;
                     case 'CloseNow':
                         $group->pivot->open_time = $later;
                         $group->pivot->close_time = $now;
//.........这里部分代码省略.........
开发者ID:AlexLeung,项目名称:ibsurvey,代码行数:101,代码来源:SurveysController.php

示例10: postEditSchool

 public function postEditSchool($id)
 {
     $user = User::find($id);
     $schools = School::where('user_id', $id)->first();
     $schools->update(['primary_name' => Input::get('primary_name'), 'primary_address' => Input::get('primary_address'), 'primary_years' => Input::get('primary_years'), 'secondary_name' => Input::get('secondary_name'), 'secondary_address' => Input::get('secondary_address'), 'secondary_years' => Input::get('secondary_years'), 'tertiary_name' => Input::get('tertiary_name'), 'tertiary_address' => Input::get('tertiary_address'), 'tertiary_years' => Input::get('tertiary_years')]);
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Employee Management Admin', 'action' => 'edited ' . $user->firstname . ' ' . $user->lastname . '\'s School Information.']);
     return Redirect::route('profile', $id)->with('alert', 'success|School Information has been updated.');
 }
开发者ID:codeblues1516,项目名称:godaddy,代码行数:8,代码来源:EmployeeController.php

示例11: test2

 public function test2()
 {
     $error = "";
     $regs = DB::table('registration')->get();
     foreach ($regs as $reg) {
         $user = new User();
         $user->name1 = strtoupper($reg->name1);
         $user->name2 = strtoupper($reg->name2);
         $user->email1 = $reg->email1;
         $user->email2 = $reg->email2;
         $user->contact1 = $reg->contact1;
         $user->contact2 = $reg->contact2;
         $user->squad = $reg->squad;
         $user->language = $reg->language;
         $school = strtoupper($reg->school);
         $city_name = ucwords(strtolower($reg->city));
         if (School::where('name', $school)->count() && City::where('name', $city_name)->count()) {
             $cityid = City::where('name', $city_name)->first();
             $school_name = School::where('name', $school)->where('city_id', $cityid->id)->first();
             $user->school_id = $school_name->id;
             $user->city_id = $cityid->id;
             $user->centre_city = $cityid->id * 10;
             $roll = "";
             if ($reg->squad === 'JUNIOR') {
                 $roll = "J";
             } else {
                 $roll = "H";
             }
             if ($reg->language === 'en') {
                 $roll .= "E";
             } else {
                 $roll .= "H";
             }
             $roll .= strval($cityid->code) . '0';
             $lastroll = User::withTrashed()->where('roll', 'LIKE', "%{$roll}%")->count();
             $roll .= str_pad(strval($lastroll + 1), 4, "0", STR_PAD_LEFT);
             $user->roll = $roll;
             $user->year = 2015;
             $user->paid = true;
             $user->comments = $reg->comments;
             $user->save();
         } else {
             if (School::where('name', $school)->count()) {
                 $error .= $city_name . '<br>';
             } elseif (City::where('name', $city_name)->count()) {
                 $error .= $school . '<br>';
             } else {
                 $error .= $school . '   ' . $city_name;
             }
         }
     }
     //        Auth::logout();
     return View::make('layouts.test3')->with('error', $error);
 }
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:54,代码来源:HomeController.php

示例12: postEditOwnSchool

 public function postEditOwnSchool($id)
 {
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'User', 'action' => 'edited School Information']);
     $schools = School::where('user_id', $id)->first();
     $schools->update(['primary_name' => Input::get('primary_name'), 'primary_address' => Input::get('primary_address'), 'primary_years' => Input::get('primary_years'), 'secondary_name' => Input::get('secondary_name'), 'secondary_address' => Input::get('secondary_address'), 'secondary_years' => Input::get('secondary_years'), 'tertiary_name' => Input::get('tertiary_name'), 'tertiary_address' => Input::get('tertiary_address'), 'tertiary_years' => Input::get('tertiary_years')]);
     return Redirect::route('profile', $id)->with('alert', 'success|School Information has been updated.');
 }
开发者ID:codeblues1516,项目名称:godaddy,代码行数:7,代码来源:UsersController.php

示例13: getBySchoolBoard

 public function getBySchoolBoard($board_id)
 {
     return School::where('schoolboard_id', '=', $board_id)->orderBy('school_name')->get();
 }
开发者ID:bmadigan,项目名称:BatchPortal2,代码行数:4,代码来源:DbSchoolRepository.php


注:本文中的School::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。