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


PHP School::find方法代码示例

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


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

示例1: studentPerSchoolFilter

 public function studentPerSchoolFilter($id)
 {
     $school = School::find($id);
     $educations = Education::where('project_id', '=', Auth::user()->curr_project_id)->where('school_id', '=', $id)->get();
     $menu = 'report';
     return View::make('reports.studentperschool', compact('educations', 'school', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:7,代码来源:ReportsController.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: 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

示例4: isexist

 function isexist($zipcode)
 {
     $Model_B = new School();
     $valid = $Model_B->find('count', array('conditions' => array('School.school_code' => $zipcode)));
     if ($valid == 1) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:Betasoft111,项目名称:notifywebapp,代码行数:10,代码来源:Teacher.php

示例5: edit

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function edit($id)
 {
     $school = School::find($id);
     if (is_null($school)) {
         return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Училището не е намерено.'));
     } else {
         $school_name = Type::find($school->type_id)->name . ' "' . $school->name . '"';
         $comments = VisitorComments::where("school_id", "=", $id)->get();
         return View::make('admin.school.comments')->with('school_name', $school_name)->with('comments', $comments);
     }
 }
开发者ID:mertindervish,项目名称:registerbg,代码行数:16,代码来源:AdminCommentController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $school = School::find($id);
     if (is_null($school)) {
         return Redirect::route('schools.index')->withErrors(array('mainError' => 'Училището не е намерено.'));
     } else {
         if ($school->status == false) {
             return Redirect::route('schools.index')->withErrors(array('mainError' => 'Училището не е намерено.'));
         }
         return View::make('view')->with('school', $school);
     }
 }
开发者ID:mertindervish,项目名称:registerbg,代码行数:18,代码来源:SchoolController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $school = School::find($id);
     if (is_null($school)) {
         return Redirect::route('admin.galleries.index')->withErrors(array('mainError' => 'Галерията не е намерена.'));
     } else {
         if ($school->canUserEdit() == false) {
             return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Нямате право да редактирате учебното заведение.'));
         }
         $photos_data = Gallery::where('school_id', '=', $id)->get();
         return View::make('admin.gallery.edit')->with('photos', $photos_data)->with('gallery_id', $id);
     }
 }
开发者ID:mertindervish,项目名称:registerbg,代码行数:19,代码来源:AdminGalleryController.php

示例8: deleteAction

 public function deleteAction()
 {
     $input = Input::all();
     $id = $input["id"];
     $schoolToUser = DB::table('schooluser')->where('school', $id);
     $schoolToClass = DB::table('schoolclass')->where('school', $id);
     $status = false;
     if ($schoolToUser->count() < 1 || $schoolToClass->count() < 1) {
         $school = School::find($id);
         $school->deleted_at = new DateTime(date('Y-m-d H:i:s'));
         $school->save();
         $status = true;
         $message = "";
     } else {
         $message = "Sorry. You cannot delete this school. \n To delete this class, you should remove the students from class and then remove this class from school first.";
     }
     $responses = array('idx' => $id, 'message' => $message, 'status' => $status);
     return Response::json($responses);
 }
开发者ID:AxelPardemann,项目名称:E-Learning-System-based-on-Laravel-and-Bootstrap,代码行数:19,代码来源:SchoolController.php

示例9: json_decode

    $req_body = json_decode($app->request->getBody());
    // Check if all fields are present
    if ($req_body->gender == NULL || $req_body->nickname == NULL || $req_body->password1 == NULL || $req_body->password2 == NULL || $req_body->school == NULL) {
        $app->halt(400, '{"message": "er is iets fout gegeaan"}');
    }
    // Check if username exists
    if (User::where('nickname', 'like', $req_body->nickname)->count()) {
        $app->halt(400, 'nickname_exists');
    }
    try {
        $user = new User();
        $user->nickname = $req_body->nickname;
        $user->gender = $req_body->gender;
        $user->password = sha1($req_body->password1);
        $user->educationLevel()->associate(EducationLevel::find((int) $req_body->schoolAdvice));
        $user->school()->associate(School::find((int) $req_body->school));
        $user->save();
        // Create token
        $token = new Token();
        $token->generateToken();
        $token->user()->associate($user);
        $token->save();
    } catch (Exception $e) {
        $app->halt(500, 'something_went_wrong');
    }
    echo $token->toJson();
});
$app->get('/user', function () use($app) {
    $app->response()->header('Content-Type', 'application/json');
    $token_key = $app->request->headers->get('Authorization');
    try {
开发者ID:Robinwist,项目名称:UXDTalentenTest,代码行数:31,代码来源:api.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $school = School::find($id);
     $school->delete();
 }
开发者ID:purplenimbus,项目名称:Nimbus-SMS,代码行数:12,代码来源:SchoolController.php

示例11: edit

 /**
  * Show the form for editing the specified school.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $school = School::find(Crypt::decrypt($id));
     return View::make('schools.edit', compact('school'));
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:11,代码来源:SchoolsController.php

示例12: deactivate

 /**
  * Deactivate school to end user.
  *
  * @param  int  $id
  * @return Response
  */
 public function deactivate($id)
 {
     $school = School::find($id);
     if (!is_null($school)) {
         $school->status = false;
         if ($school->save()) {
             return Redirect::route('admin.schools.index')->withErrors(array('mainSuccess' => 'Учебното заведение е успешно скрит от сайта.'));
         } else {
             return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Грешка с базата данни.'));
         }
     } else {
         return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Учебното заведение не е намерено.'));
     }
 }
开发者ID:mertindervish,项目名称:registerbg,代码行数:20,代码来源:AdminSchoolController.php

示例13: generatedpasswords

 public function generatedpasswords()
 {
     $school = School::find(intval(Input::get('school')));
     $text = '';
     foreach (User::where('school_id', intval(Input::get('school')))->where('paid', 1)->get() as $user) {
         $password = str_random(6);
         $hash = Hash::make($password);
         $user->password = $hash;
         $user->save();
         $text .= '<tr><td>' . $user->name1 . '</td><td>' . $user->name2 . '</td><td>' . $user->roll . '</td><td> ' . $password . '</td></tr>';
     }
     return View::make('admin.generatedpass')->with('body', $text)->with('school', $school);
 }
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:13,代码来源:AdminController.php

示例14: admitdownload

 public function admitdownload($school)
 {
     try {
         $school = Crypt::decrypt($school);
         $school = School::find($school);
     } catch (Exception $e) {
         return View::make('layouts.error');
     }
     return Response::download('admit-cards/schools/' . $school->id . '.pdf', $school->name . '.pdf', array('Content-type:application/pdf', 'filename'));
 }
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:10,代码来源:CRepController.php

示例15: test3

 public function test3()
 {
     $user = User::find(1);
     $password = str_random(6);
     $school = School::find($user->school_id);
     $city = City::find($user->city_id);
     $state = State::find($city->state_id);
     $name = "Aneesh Dash";
     $to = "Aneesh Dash<aneeshdash@yahoo.co.in>";
     $subject = "Technothlon Registration Details";
     $message = "\n        <html lang='en'>\n        <head>\n    <meta charset='UTF-8'>\n    <title>Technothlon Registration Details</title>\n    </head>\n    <body>\n    <div style='display: table; margin: 0 auto'>\n    <div style='text-align: center'>\n        <img src='technothlon.png'; width='300px'>\n    </div><br><br>\n    <div style='display: inline-block'>\n        Dear" . $name . ",<br>\n        You have successfully registered for Technothlon 2015 with the following details: <br><br>\n        <div id='school'>\n            <div style='display: inline-block'>\n                <div>\n                    School Name:\n                </div>\n                <div>\n                    School Address:\n                </div>\n                <div>\n                    City:\n                </div>\n                <div>\n                    State\n                </div>\n            </div>\n            <div style='display: inline-block; margin-left: 10px'>\n                <div>\n                    " . $school->name . "\n                </div>\n                <div>\n                    " . $school->address . "\n                </div>\n                <div>\n                    " . $city->name . "\n                </div>\n                <div>\n                    " . $state->name . "\n                </div>\n            </div>\n        </div>\n        <div><br>\n            <div style='display: inline-block'>\n                Squad: {{ {$user->squad} }}\n            </div>\n            <div style='display: inline-block; margin-left: 20px'>\n                Medium: {{ {$user->language} }}\n            </div>\n        </div><br>\n        <div id='details'>\n            <div style='display: inline-block'>\n                <div style='display: inline-block'>\n                    <div>\n                        Name:\n                    </div>\n                    <div>\n                        Email:\n                    </div>\n                    <div>\n                        Contact:\n                    </div>\n                </div>\n                <div style='display: inline-block; margin-left: 10px'>\n                    <div>\n                        " . $user->name1 . "\n                    </div>\n                    <div>\n                        " . $user->email1 . "\n                    </div>\n                    <div>\n                        +91" . $user->contact1 . "\n                    </div>\n                </div>\n            </div>\n            <div style='display: inline-block; margin-left: 20px'>\n                <div style='display: inline-block'>\n                    <div>\n                        Name:\n                    </div>\n                    <div>\n                        Email:\n                    </div>\n                    <div>\n                        Contact:\n                    </div>\n                </div>\n                <div style='display: inline-block; margin-left: 10px'>\n                    <div>\n                        " . $user->name2 . "\n                    </div>\n                    <div>\n                        " . $user->email2 . "\n                    </div>\n                    <div>\n                        +91" . $user->contact2 . "\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div><br><br><br><br>\n    <div id='roll'>\n        Given below is your roll number and password which will be required for accessing technopedia<br> and other features of Technothlon.<br><br>\n        <div style='display: inline-block;'>\n            <div>Roll Number:</div>\n            <div>Password:</div>\n        </div>\n        <div style='display: inline-block;'>\n            <div>" . $user->roll . "</div>\n            <div>" . $password . "</div>\n        </div><br><br>\n        <div id='details'>\n            <ul>\n                <li>The exam is on 19th July, 2015.</li>\n                <li>Technopedia starts from the 15th of every month and ends on the 10th of next month.</li>\n                <li>The first Technopedia starts from January</li>\n                <li>In case of any discrepancy, <a href='http://technothlon.techniche.org/contact' target='_blank'>Contact Us</a>. </li>\n            </ul>\n        </div>\n    </div>\n</div>\n</body>\n</html>\n        ";
     // Always set content-type when sending HTML email
     $headers = "MIME-Version: 1.0" . "\r\n";
     $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
     // More headers
     $headers .= 'From: Technothlon<noreply@technothlon.techniche.com>' . "\r\n";
     mail($to, $subject, $message, $headers);
 }
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:18,代码来源:HomeController.php


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