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


PHP Program::where方法代码示例

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


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

示例1: index

 public function index()
 {
     $hours = Hour::all();
     $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
     $menu = 'data';
     return View::make('hours.index', compact('hours', 'programs', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:7,代码来源:HoursController.php

示例2: studentPerprogramFilter

 public function studentPerprogramFilter($id)
 {
     $program_id = $id;
     $program = Program::with('courses')->find($program_id);
     $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
     $menu = 'report';
     return View::make('reports.studentperprogram', compact('programs', 'program', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:8,代码来源:ReportsController.php

示例3: create

 public function create()
 {
     $classifications = Classification::where('category', '=', 'Course')->get();
     $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->get();
     $majors = Major::all();
     $generations = Generation::all();
     $menu = 'project';
     return View::make('courses.create', compact('classifications', 'programs', 'generations', 'majors', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:9,代码来源:CoursesController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $programlist = Program::where('programs.degreelevel', 'U')->whereNotIn('programs.programid', array(62, 66, 38))->get();
     //Averaage students per program
     $programAveArray = [];
     $programBatchAttrition = [];
     foreach ($programlist as $program) {
         $progStudents = round($program->getAveStudents(), 2);
         $programAveArray[$program->programtitle] = $progStudents;
         $programBatchAttrition[$program->programtitle] = $program->getAveAttrition();
     }
     //return page
     return View::make('program.program', ['programlist' => $programlist, 'programAveArray' => $programAveArray, 'programBatchAttrition' => $programBatchAttrition]);
 }
开发者ID:jpcamba,项目名称:attrition,代码行数:19,代码来源:ProgramController.php

示例5: getYearlySemDifference

 public function getYearlySemDifference($year)
 {
     $studentsSem1 = $this->studentterms()->where('aysem', strval($year) . '1')->count();
     $studentsSem2 = $this->studentterms()->where('aysem', strval($year) . '2')->count();
     if ($this->programid == 28) {
         $domProgram = Program::where('programid', 38)->first();
         $domSem1 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '1')->count();
         $domSem2 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '2')->count();
         $studentsSem1 = $studentsSem1 + $domSem1;
         $studentsSem2 = $studentsSem2 + $domSem2;
     }
     $semDifference = $studentsSem2 - $studentsSem1;
     return $semDifference;
 }
开发者ID:jpcamba,项目名称:attrition,代码行数:14,代码来源:Program.php

示例6: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('units', function (Blueprint $table) {
         $table->decimal('years_before_drop')->nullable();
     });
     //campus
     $campus = Campus::where('unitid', 2)->first();
     $campus->years_before_drop = $campus->getAveYearsBeforeDropout();
     $campus->ave_batch_attrition = $campus->getAveAttrition();
     $campus->save(['timestamps' => false]);
     //program
     $programlist = Program::where('programs.degreelevel', 'U')->whereNotIn('programs.programid', array(62, 66, 38, 22))->get();
     foreach ($programlist as $program) {
         $program->years_stay = $program->getAveYearsOfStay();
         $program->years_before_shift = $program->getAveYearsBeforeShifting();
         $program->years_before_drop = $program->getAveYearsBeforeDropout();
         $program->ave_batch_attrition = $program->getAveAttrition();
         $program->ave_batch_shift = $program->getAveShiftRate();
         $program->ave_students = $program->getAveStudents();
         $program->save(['timestamps' => false]);
     }
     //department
     $departmentlist = Department::whereHas('programs', function ($q) {
         $q->whereNotIn('programid', array(62, 66, 38, 22));
         $q->where('degreelevel', 'U');
     })->get();
     foreach ($departmentlist as $department) {
         $department->ave_batch_attrition = $department->getAveAttrition();
         $department->ave_batch_shift = $department->getAveShiftRate();
         $department->ave_students = $department->getAveStudents();
         $department->save(['timestamps' => false]);
     }
     //college
     $departmentlist = Department::whereHas('programs', function ($q) {
         $q->whereNotIn('programid', array(62, 66, 38, 22));
         $q->where('degreelevel', 'U');
     })->get();
     $collegelist = [];
     foreach ($departmentlist as $department) {
         array_push($collegelist, $department->college);
     }
     $collegelist = array_unique($collegelist);
     foreach ($collegelist as $college) {
         $college->ave_batch_attrition = $college->getAveAttrition();
         $college->ave_batch_shift = $college->getAveShiftRate();
         $college->ave_students = $college->getAveStudents();
         $college->save(['timestamps' => false]);
     }
 }
开发者ID:jpcamba,项目名称:attrition,代码行数:54,代码来源:2016_03_26_150236_add_data_to_campus.php

示例7: getYearlySemDifference

 public function getYearlySemDifference($year)
 {
     $programs = $this->programs()->whereNotIn('programid', array(62, 66, 38, 117))->where('degreelevel', 'U')->lists('programid');
     $studentsSem1 = Studentterm::where('aysem', strval($year) . '1')->whereIn('programid', $programs)->count();
     $studentsSem2 = Studentterm::where('aysem', strval($year) . '2')->whereIn('programid', $programs)->count();
     //if College of Medicine
     if ($this->unitid === 7) {
         $domProgram = Program::where('programid', 38)->first();
         $domSem1 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '1')->count();
         $domSem2 = $domProgram->studentterms()->whereIn('yearlevel', array(3, 4))->where('aysem', strval($year) . '2')->count();
         $studentsSem1 = $studentsSem1 + $domSem1;
         $studentsSem2 = $studentsSem2 + $domSem2;
     }
     $semDifference = $studentsSem2 - $studentsSem1;
     return $semDifference;
 }
开发者ID:jpcamba,项目名称:attrition,代码行数:16,代码来源:College.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $list = [];
     $n = 0;
     DB::table('tmp_musics')->chunk(10000, function ($data) use(&$list, &$n) {
         foreach ($data as $record) {
             ++$n;
             // 合并整段记录
             $key = implode('_', [$record->audio_part, $record->acrid]);
             if (empty($list) or isset($list[$key])) {
                 $list[$key][] = $record;
                 if (!empty($record->acrid)) {
                     continue;
                 }
                 // 插入数据
             } else {
                 // 插入歌手记录
                 $list = current($list);
                 $first = current($list);
                 $end = end($list);
                 $artistIds = [];
                 foreach (explode('|', $first->artists) as $name) {
                     $artist = Artist::firstOrCreate(['name' => $name]);
                     $artist->increment('counts', 1);
                     $artistIds[] = $artist->id;
                 }
                 // 插入音乐记录
                 $music = Music::firstOrCreate(['title' => $first->title, 'album' => $first->album, 'genres' => $first->genres, 'label' => $first->label, 'release_date' => $first->release_date, 'acrid' => $first->acrid, 'isrc' => $first->isrc, 'upc' => $first->upc, 'external_metadata' => $first->external_metadata]);
                 // 插入音乐歌手记录
                 $music->artists()->sync($artistIds);
                 // 插入节目音乐记录
                 Program::where('date', $first->program_date)->first()->musics()->attach($music->id, ['program_part' => $first->audio_part, 'start_sec' => $first->audio_start_sec, 'end_sec' => $end->audio_start_sec, 'url' => self::getQiniuUrl($first->program_date, $first->audio_start_sec, $end->audio_start_sec)]);
                 // 插入节目歌手记录
                 foreach ($music->artists as $artist) {
                     Program::where('date', $first->program_date)->first()->artists()->attach($artist->id);
                 }
                 // 输出日志
                 $this->info(implode("\t", [$n, $music->id, $first->artists, $first->title]));
             }
             // 清空列表
             $list = [];
         }
     });
 }
开发者ID:popfeng,项目名称:zao,代码行数:49,代码来源:Deploy.php

示例9: update

 /**
  * 更新请求
  *
  * @param Request $request
  * @param int $id
  * @return void
  */
 public function update(Request $request, $id)
 {
     // 验证
     $this->validate($request, ['topic' => 'string', 'participants' => 'string', 'state' => 'required|in:1,-1', 'reply_message' => 'required|string']);
     $log = Comment::find($id);
     // 更新
     DB::transaction(function () use($request, $log) {
         if (Comment::STATUS['ENABLE'] == $request->state) {
             // 参与人
             $participantIds = [];
             $participantNames = Participant::filterParticipantNames($request->participants);
             if (!empty($participantNames)) {
                 foreach ($participantNames as $name) {
                     $participant = Participant::firstOrCreate(['name' => $name]);
                     $participant->increment('counts', 1);
                     $participantIds[] = $participant->id;
                 }
             }
             // 节目
             $program = Program::where('date', date('Y-m-d', strtotime($log->metas->thread_key)))->first();
             $topic = Program::filterTopic($request->topic);
             if (!empty($topic)) {
                 $program->update(['topic' => $topic]);
             }
             if (!empty($participantIds)) {
                 $program->participants()->sync($participantIds);
             }
         }
         // 刷新首页文件缓存
         Cache::forget(Program::INDEX_CACHE_KEY);
         // 刷新贡献记录页文件缓存
         Cache::forget(Comment::CONTRIBUTION_CACHE_KEY);
         // 记录日志
         Comment::where('id', $log->id)->update(['ext_is_agree' => $request->state]);
     });
     // 回复评论
     $state = Comment::replyPost($request->reply_message, $log->metas->thread_id, $log->metas->post_id, $log->metas->author_email);
     // 跳转
     $status = ['status' => $state ? 'success' : 'error', 'message' => $state ? '审核成功~' : '审核成功,回复失败'];
     return Redirect::to($request->_redirect_url)->with($status['status'], $status['message']);
 }
开发者ID:popfeng,项目名称:zao,代码行数:48,代码来源:ContributionsController.php

示例10: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('studentdropouts', function (Blueprint $table) {
         //
         /*Add data to include Applied Physics (programid = 117) and batch 2011 and 2012
         		1. Get all students from 2011 and 2012 who is taking applied physics
         		2. Remove students who shifted out
         		3. If batch 2011 and has no studentterm in 2012 and 2013 then add student to studentdropouts table
         		4. If batch 2012 and has no studentterm in 2013 then add student to studentdropouts table
         		*/
         $program = Program::where('programid', 117)->first();
         $shiftees = Studentshift::where('program1id', $program->programid)->lists('studentid');
         $min = 201100000;
         $max = 201300000;
         $studentids = Studentterm::select('studentid')->where('studentid', '>', $min)->where('studentid', '<', $max)->whereNotIn('studentid', $shiftees)->where('programid', $program->programid)->groupBy('studentid')->lists('studentid');
         foreach ($studentids as $studentid) {
             $student = Student::where('studentid', $studentid)->first();
             if ($student->studentid < 201200000) {
                 //batch 2011
                 $stayed = $student->studentterms()->where('year', 2012)->orWhere('year', 2013)->count();
             } else {
                 //batch 2012
                 $stayed = $student->studentterms()->where('year', 2013)->count();
             }
             if ($stayed === 0) {
                 //insert to studentdropout
                 $semcount = $student->studentterms()->where('programid', $program->programid)->whereRaw('CAST(aysem AS TEXT) NOT LIKE \'%3\'')->count();
                 $newDropout = new Studentdropout();
                 $newDropout->studentid = $student->studentid;
                 $newDropout->programid = $program->programid;
                 $newDropout->lastprogramid = $program->programid;
                 $newDropout->collegeid = $program->department->college->unitid;
                 $newDropout->semesters = $semcount;
                 $newDropout->save();
             }
         }
     });
 }
开发者ID:jpcamba,项目名称:attrition,代码行数:43,代码来源:2016_03_14_131033_insert_data_to_studentdropouts_table.php

示例11: storeUser

 public function storeUser()
 {
     $redir = $this->check();
     if (isset($redir)) {
         return $redir;
     }
     $user = Sentry::getUser();
     if (Input::has('editor1')) {
         $summary = Input::get('editor1');
         $user->summary = $summary;
     }
     if (Input::has('editor2')) {
         $experience = Input::get('editor2');
         $user->experience = $experience;
     }
     if (Input::has('del-prog')) {
         $del = Input::get('del-prog');
         $ar = array();
         foreach ($del as $key => $val) {
             $ar[] = $key;
         }
         foreach ($ar as $delid) {
             $progs = Program::where('ProgramName', '=', $delid)->get();
             foreach ($progs as $prog) {
                 $user->programs()->detach($prog->id);
             }
         }
     } elseif (Input::has('program') && !Input::has('del-prog')) {
         $id = Input::get('program');
         $progs = Program::where('ProgramName', '=', $id)->take(1)->get();
         foreach ($progs as $prog) {
             $user->programs()->attach($prog->id);
         }
     }
     if (Input::has('email') && Input::has('fname') && Input::has('lname')) {
         $email = Input::get('email');
         $fname = Input::get('fname');
         $lname = Input::get('lname');
         $user->email = $email;
         $user->first_name = $fname;
         $user->last_name = $lname;
     }
     if (Input::hasFile('photo') && Input::file('photo')->isValid()) {
         $formatTable = array('image/jpeg', 'image/png', 'image/gif', 'image/tga', 'image/tif', 'image/bmp');
         $file = Input::file('photo');
         $mime = $file->getMimeType();
         foreach ($formatTable as $mimecheck) {
             if ($mime == $mimecheck) {
                 $filename = Str::random(20) . '.' . $file->getClientOriginalExtension();
                 $destinationPath = "public/uploads";
                 $succes = $file->move($destinationPath, $filename);
                 $bodytag = str_replace("public/", "", $succes->getPathname());
                 $user->avatar = $bodytag;
                 $img = Image::make($bodytag)->resize(612, 612)->save();
             }
         }
     }
     $user->save();
     //$user = Sentry::getUser();
     //$prgs= $user->programs()->get(); var_dump($prgs); $user->programs()->attach(714);
     $this->layout->title = APPNAME;
     $programs = Program::all();
     $this->layout->content = View::make('main.profile.edit')->with('user', $user)->with('programs', $programs);
 }
开发者ID:g0ddish,项目名称:ResearchMonster,代码行数:64,代码来源:ProfileController.php

示例12: index

 public function index()
 {
     $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->get();
     $menu = 'project';
     return View::make('programs.index', compact('programs', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:6,代码来源:ProgramsController.php


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