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


PHP School::with方法代码示例

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


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

示例1: destroy

 public function destroy($id)
 {
     $school = School::with('educations')->find($id);
     if ($school->educations->count() > 0) {
         Session::flash('message', 'Tidak dapat menghapus sekolah! Sekolah ini merupakan sekolah asal salah satu siswa');
     } else {
         School::destroy($id);
         Session::flash('message', 'Sukses menghapus data sekolah!');
     }
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:10,代码来源:SchoolsController.php

示例2: function

        if ($app->request->isGet()) {
            $data['skill'] = $skill->toArray();
        } else {
            if ($app->request->isPost()) {
                $skill->name = $app->request->post('title');
                $skill->save();
                $data['new_skill'] = $skill->toArray();
            }
        }
        $app->render('skills/edit.html', $data);
    })->via('GET', 'POST')->name('skills_edit');
});
$app->group('/schools', function () use($app, $data) {
    $data['request_method'] = $app->request->getMethod();
    $app->get('/', function () use($app, $data) {
        $data['schools'] = School::with('User')->orderBy('name', 'ASC')->get()->toArray();
        $app->render('schools/overview.html', $data);
    })->name('schools_overview');
    $app->map('/delete/:id', function ($id) use($app, $data) {
        $data['school'] = School::find($id);
        if ($app->request->isPost()) {
            $data['school']->delete();
        }
        $app->render('schools/delete.html', $data);
    })->via('GET', 'POST')->name('schools_delete');
    $app->map('/new', function () use($app, $data) {
        if ($app->request->isPost()) {
            $school = new School();
            $school->name = $app->request->post('name');
            $school->save();
            $data['new_school'] = $school;
开发者ID:Robinwist,项目名称:UXDTalentenTest,代码行数:31,代码来源:admin.php

示例3: show

 public function show($id)
 {
     return Response::json(['msg' => 'valid', 'school' => School::with(['affiliations', 'types'])->find($id)]);
 }
开发者ID:shubhomoy,项目名称:evolve,代码行数:4,代码来源:SchoolController.php

示例4: recapSchoolGeneration

 public function recapSchoolGeneration()
 {
     $educations = Education::with('school')->where('project_id', '=', Auth::user()->curr_project_id)->groupBy('school_id')->get();
     $generations = Generation::all();
     $menu = 'report';
     $schools = array();
     foreach ($educations as $education) {
         $statistics = array();
         foreach ($generations as $generation) {
             $count = School::with(array('educations', 'educations.issues'))->join('educations', 'educations.school_id', '=', 'schools.id')->join('issues', 'issues.id', '=', 'educations.issue_id')->where('issues.generation_id', '=', $generation->id)->where('schools.id', '=', $education->school_id)->count();
             $statistics[] = array('count' => $count);
         }
         $schools[] = array('id' => $education->school_id, 'name' => $education->school->name, 'statistics' => $statistics);
     }
     return View::make('reports.recapschoolgeneration', compact('schools', 'generations', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:16,代码来源:ReportsController.php


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