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


PHP Subject::where方法代码示例

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


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

示例1: showDashboard

 public function showDashboard()
 {
     $data = [];
     $loginid = Session::get('user')->id;
     $collegeid = Session::get('user')->collegeid;
     $flag = Session::get('user')->flag;
     $tb = "";
     if ($flag == 1) {
         $tb = "Admin";
     } else {
         if ($flag == 2) {
             $tb = "Teacher";
         } else {
             if ($flag == 3) {
                 $tb = "Student";
             } else {
                 $tb = "Staff";
             }
         }
     }
     $dt = $tb::where('loginid', '=', $loginid)->first();
     $data['name'] = $dt->name;
     $data['pic'] = $dt->profilepic;
     $data['id'] = $loginid;
     //Cards value
     $data['students'] = Student::where('collegeid', '=', $collegeid)->count();
     $data['teachers'] = Teacher::where('collegeid', '=', $collegeid)->count();
     $data['subjects'] = Subject::where('collegeid', '=', $collegeid)->count();
     $data['parents'] = $data['students'] * 2;
     return View::make('pages.dashboard', array('data' => $data, 'flag' => $flag));
 }
开发者ID:pankaja455,项目名称:WebSchool,代码行数:31,代码来源:HomeController.php

示例2: find

 /**
  * Find a subject of an University
  * 
  * @return JSON Ajax
  */
 public function find()
 {
     if (Request::ajax()) {
         $subject = Subject::where('name', Input::get('name'))->where('university_id', Auth::id())->first();
         return Response::json($subject);
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:12,代码来源:SubjectController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($classId, $subjectId)
 {
     $user = \Auth::user();
     $term = 'First Term';
     if ($_GET['class']) {
         $this->class = $_GET['class'];
         $this->subject = $_GET['subject'];
         \Session::put('class', $_GET['class']);
         \Session::put('subject', $_GET['subject']);
     }
     $classe_id = Classe::where('name', $classId)->first()->id;
     $subject_id = Subject::where('name', $this->subject)->first()->id;
     $classeName = Classe::where('name', $this->class)->first()->name;
     $subjectName = Subject::where('name', $this->subject)->first()->name;
     //dd($classe_id);
     $count = 1;
     $questions = Question::where('classe_id', $classId)->where('subject_id', $subjectId)->orderBy(\DB::raw('RAND()'))->get();
     $totals = Question::where('classe_id', $classId)->where('subject_id', $subjectId)->paginate(1);
     $checked_items = [];
     if (\Session::has('checked_items')) {
         $checked_items = \Session::get('checked_items');
     }
     // $checked_items = array_merge($checked_items, \Input::get('abc'));
     \Session::flash('checked_items', $checked_items);
 }
开发者ID:newgenesisdesigns,项目名称:laravel5,代码行数:30,代码来源:ExaminationsController.php

示例4: findUnusedSection

 /**
  * Find a unused section
  * 
  * @return JSON Ajax
  */
 public function findUnusedSection()
 {
     if (Request::ajax()) {
         $subject = Subject::where('university_id', Auth::id())->where("_id", new MongoId(Input::get("_id")))->first();
         $sections = $subject->sections()->where('is_free', true)->whereNull('deleted_at')->get();
         if (count($sections) > 0) {
             return Response::json(array('subject' => $subject->_id, 'sections' => $sections));
         }
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:15,代码来源:SectionController.php

示例5: getLastIdSubject

 public function getLastIdSubject($idCourse)
 {
     $idCourseTest = (int) ($idCourse / 1000) * 1000;
     $idCoureFirst = (int) ($idCourse / 1000000);
     $subject = Subject::where('id_course', '>=', $idCourseTest)->where('id_course', '<=', $idCourseTest + 100)->orderBy('id', 'desc')->first();
     if (is_null($subject)) {
         return $idCoureFirst * 1000000;
     } else {
         $id = (string) $subject->id;
         $first = (string) $idCoureFirst;
         $last = substr($id, 3, strlen($id) - 3);
         return $first . $last;
     }
 }
开发者ID:nguyensonghao,项目名称:api,代码行数:14,代码来源:Subject.php

示例6: sitemap

 public function sitemap()
 {
     $sitemap = App::make("sitemap");
     // set item's url, date, priority, freq
     $sitemap->add(Request::root(), '2012-08-25T20:10:00+02:00', '1.0', 'daily');
     $sitemap->add(Request::root() . "/marketing", '2013-08-20T20:20:00+02:00', '1.0', 'monthly');
     $sitemap->add(Request::root() . "/puskice", '2013-08-20T20:20:00+02:00', '1.0', 'monthly');
     if (Cache::has('posts_query')) {
         $posts = Cache::get('posts_query');
     } else {
         $posts = News::get();
         Cache::put('posts_query', $posts, 10080);
     }
     foreach ($posts as $post) {
         if ($post->post_type == 1) {
             $sitemap->add(Request::root() . "/vest/" . Puskice::dateToUrl($post->created_at) . "/" . $post->permalink, $post->updated_at, '1.0', 'daily');
         }
         if ($post->post_type == 2) {
             $sitemap->add(Request::root() . "/stranica/" . $post->permalink, $post->updated_at, '1.0', 'daily');
         }
         if ($post->post_type == 3) {
             $subject = Subject::where('news_id', '=', $post->id)->first();
             if ($subject != null) {
                 $sitemap->add(Request::root() . "/" . Puskice::getYear($subject->semester) . "/" . Puskice::getDepartment($subject->department) . "/" . $post->permalink, $post->updated_at, '1.0', 'monthly');
             } else {
                 Log::info('Predmet za vest: ' . $post->id . ' nije definisan');
             }
         }
     }
     if (Cache::has('meme_query')) {
         $memes = Cache::get('meme_query');
     } else {
         $memes = MemeInstance::get();
         Cache::put('meme_query', $memes, 10080);
     }
     foreach ($memes as $meme) {
         $sitemap->add(Request::root() . "/meme/" . $meme->id . "-" . $meme->permalink, $meme->updated_at, '1.0', 'daily');
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     return $sitemap->render('xml');
 }
开发者ID:Puskice,项目名称:PuskiceCMS,代码行数:41,代码来源:RSSController.php

示例7: getlist

 public function getlist()
 {
     $rules = ['class' => 'required', 'section' => 'required', 'shift' => 'required', 'session' => 'required', 'date' => 'required', 'subject' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/attendance/list/')->withErrors($validator);
     } else {
         $classes2 = ClassModel::orderby('code', 'asc')->lists('name', 'code');
         $subjects = Subject::where('class', Input::get('class'))->lists('name', 'code');
         $attendance = DB::table('Attendance')->join('Student', 'Attendance.regiNo', '=', 'Student.regiNo')->select('Attendance.id', 'Attendance.regiNo', 'Student.rollNo', 'Student.firstName', 'Student.middleName', 'Student.lastName', 'Attendance.status')->where('Attendance.class', '=', Input::get('class'))->where('Attendance.section', '=', Input::get('section'))->Where('Attendance.shift', '=', Input::get('shift'))->where('Attendance.session', '=', trim(Input::get('session')))->where('Attendance.subject', '=', Input::get('subject'))->where('Attendance.date', '=', $this->parseAppDate(Input::get('date')))->get();
         $formdata = new formfoo();
         $formdata->class = Input::get('class');
         $formdata->section = Input::get('section');
         $formdata->shift = Input::get('shift');
         $formdata->session = Input::get('session');
         $formdata->subject = Input::get('subject');
         $formdata->date = Input::get('date');
         if (count($attendance) == 0) {
             $noResult = array("noresult" => "No Attendance Found!!");
             return View::Make('app.attendanceList', compact('classes2', 'attendance', 'subjects', 'formdata', 'noResult'));
             //return Redirect::to('/attendance/list')->withInput(Input::all())->with("noresult","No Attendance Found!!");
         }
         return View::Make('app.attendanceList', compact('classes2', 'attendance', 'subjects', 'formdata'));
     }
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:25,代码来源:attendanceController.php

示例8: getlist

 public function getlist()
 {
     $rules = ['class' => 'required', 'section' => 'required', 'shift' => 'required', 'session' => 'required', 'exam' => 'required', 'subject' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/mark/list/')->withErrors($validator);
     } else {
         $classes2 = ClassModel::orderby('code', 'asc')->lists('name', 'code');
         $subjects = Subject::where('class', Input::get('class'))->lists('name', 'code');
         $marks = DB::table('Marks')->join('Student', 'Marks.regiNo', '=', 'Student.regiNo')->select('Marks.id', 'Marks.regiNo', 'Student.rollNo', 'Student.firstName', 'Student.middleName', 'Student.lastName', 'Marks.written', 'Marks.mcq', 'Marks.practical', 'Marks.ca', 'Marks.total', 'Marks.grade', 'Marks.point', 'Marks.Absent')->where('Marks.class', '=', Input::get('class'))->where('Marks.section', '=', Input::get('section'))->Where('Marks.shift', '=', Input::get('shift'))->where('Marks.session', '=', trim(Input::get('session')))->where('Marks.subject', '=', Input::get('subject'))->where('Marks.exam', '=', Input::get('exam'))->get();
         $formdata = new formfoo();
         $formdata->class = Input::get('class');
         $formdata->section = Input::get('section');
         $formdata->shift = Input::get('shift');
         $formdata->session = Input::get('session');
         $formdata->subject = Input::get('subject');
         $formdata->exam = Input::get('exam');
         if (count($marks) == 0) {
             $noResult = array("noresult" => "No Results Found!!");
             //return Redirect::to('/mark/list')->with("noresult","No Results Found!!");
             return View::Make('app.markList', compact('classes2', 'subjects', 'marks', 'noResult', 'formdata'));
         }
         return View::Make('app.markList', compact('classes2', 'subjects', 'marks', 'formdata'));
     }
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:25,代码来源:markController.php

示例9: exportData

 public function exportData($id_course)
 {
     $listSubject = Subject::select('id', 'name', 'id_course', 'mean', 'total', 'num_word', 'time_date')->where('id_course', $id_course)->get();
     $size = count($listSubject);
     for ($i = 0; $i < $size; $i++) {
         $subject = $listSubject[$i];
         $count = Word::where('id_subject', $subject->id)->count();
         Subject::where('id', $subject->id)->update(array('total' => $count));
     }
     try {
         $course_name = $this->convertNameCourse($id_course);
         $strListSubject = json_encode(Subject::select('id', 'name', 'id_course', 'mean', 'total', 'num_word', 'time_date')->where('id_course', $id_course)->get());
         $strListWord = json_encode(Word::select('id_word', 'id_subject', 'id_course', 'word', 'mean', 'example', 'example_mean', 'num_ef', 'time_date', 'next_time', 'num_n', 'num_i', 'max_q', 'phonetic', 'des')->where('id_course', $id_course)->get());
         $filePathSubject = public_path() . '/AllData/' . $course_name . '/' . $id_course . '/json/';
         $filePathWord = public_path() . '/AllData/' . $course_name . '/' . $id_course . '/json/';
         $this->createFolder($filePathSubject);
         $this->createFolder($filePathWord);
         $fileNameSubject = $filePathSubject . 'subject.json';
         $fileNameWord = $filePathWord . 'words.json';
         $fileSubject = fopen($fileNameSubject, "w");
         $fileWord = fopen($fileNameWord, "w");
         if (fwrite($fileSubject, $strListSubject) && fwrite($fileWord, $strListWord)) {
             fclose($fileSubject);
             fclose($fileWord);
             return true;
         } else {
             fclose($fileSubject);
             fclose($fileWord);
             return false;
         }
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:nguyensonghao,项目名称:api,代码行数:34,代码来源:WordController.php

示例10: singleSubject

 public function singleSubject($year, $department, $permalink)
 {
     try {
         $permalink = str_replace("_", "-", $permalink);
         if (Session::get('user_level') >= Config::get('cms.viewAdminNews')) {
             $page = News::where('post_type', '=', 3)->where('published', '>=', 1)->where('permalink', '=', $permalink)->firstOrFail();
         } else {
             $page = News::where('post_type', '=', 3)->where('published', '=', 2)->where('created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('permalink', '=', $permalink)->firstOrFail();
         }
         $subjects = Subject::where('news_id', '=', $page->id)->get();
         $sub = Subject::where('news_id', '=', $page->id)->first();
         $allow = false;
         foreach ($subjects as $key => $subject) {
             if ($year == Puskice::getYear($subject->semester) && Puskice::getDepartment($subject->department) == $department) {
                 $allow = true;
             }
         }
         if (!$allow) {
             App::abort(404);
         }
         $articles = News::inCategories(Config::get('settings.homepage'))->where('published', '=', 2)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(10)->get();
         $featured = News::where('published', '=', 2)->where('featured', '=', 1)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->orderBy('created_at', 'desc')->take(3)->get();
         $results = News::inCategories(Config::get('settings.results'))->where('published', '=', 2)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get();
         $featuredImage = News::inCategories(array(25))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(3)->get();
         $didYouKnow = News::inCategories(array(30))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(3)->get();
         $magazine = News::inCategories(Config::get('settings.magazine'))->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('published', '=', 2)->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get();
         $ourComment = News::inCategories(array(17))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get();
         $feed = getFeed('http://bazaznanja.puskice.org/feed/qa.rss', 4);
         $poll = null;
         $poll = Poll::where('published', '=', '1')->where('end_date', '>', date("Y-m-d H:i:s", strtotime('now')))->where('created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->first();
         if (isset($poll->id)) {
             $poll->pollOptions;
         }
         View::share('title', strip_tags($page->title) . " | Пушкице");
         $ogimage = firstImage($page);
         $meta = "\t<meta property='og:image' content='" . str_replace(" ", "%20", $ogimage) . "'/>\n\t\t\t\t\t\t<meta property='og:title' content='" . __($page->title . " | Пушкице") . "'/>\n\t\t\t\t\t\t<meta property='fb:app_id' content='355697367892039'/>\n\t\t\t\t\t\t<meta property='og:site_name' content='" . __("Пушкице - ФОН Андерграунд") . "'/>\n\t\t\t\t\t\t<meta property='og:type' content='article'/>\n\t\t\t\t\t\t<meta property='og:url' content='" . _l(Request::root() . "/" . Puskice::getYear($sub->semester) . "/" . Puskice::getDepartment($sub->department) . "/" . $page->permalink) . "'/>\n\t\t\t\t\t\t<meta property='og:description' content='" . __(dots(strip_tags($page->short_content), 500)) . "' />\n\t\t\t\t\t\t<meta name='twitter:card' content='summary_large_image'>\n\t\t\t\t\t\t<meta name='twitter:site' content='" . __("Пушкице - ФОН Андерграунд") . "'>\n\t\t\t\t\t\t<meta name='twitter:creator' content='@puskice'>\n\t\t\t\t\t\t<meta name='twitter:domain' content='puskice.org'>\n\t\t\t\t\t\t<meta name='twitter:app:name:iphone' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:app:name:ipad' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:title' content='" . __($page->title . " | Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:description' content='" . __(dots(strip_tags($page->short_content), 500)) . "'>\n\t\t\t\t\t\t<meta name='twitter:image' content='" . str_replace(" ", "%20", $ogimage) . "'>";
         $page->view_count++;
         $page->save();
         $data = array('articles' => $articles, 'featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'meta' => $meta, 'sub' => $sub, 'page' => $page);
         $this->setLayout($data);
         $this->layout->center = View::make('frontend.content.subject', $data);
     } catch (Exception $e) {
         return App::abort(404);
     }
 }
开发者ID:Puskice,项目名称:PuskiceCMS,代码行数:45,代码来源:PublicNewsController.php

示例11: function

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    return View::make('sem');
})->before('auth');
Route::get('main/{sem}', function ($sem) {
    $subjects = Subject::where('sem', '=', $sem)->orderBy('name')->get();
    return View::make('sub')->with('subjects', $subjects)->with('sem', $sem);
})->before('auth');
Route::get('question/{id}', 'QuestionController@showQuestion')->before('auth');
//Show
Route::get('question/create/{id}', 'QuestionController@createQuestion')->before('auth');
//Create
Route::post('question/{id}', 'QuestionController@storeQuestion')->before('auth');
//Store
Route::get('question/edit/{qid}', 'QuestionController@editQuestion')->before('auth');
//Edit
Route::put('question/{qid}', 'QuestionController@updateQuestion')->before('auth');
//Update
Route::delete('question/{qid}', 'QuestionController@deleteQuestion')->before('auth');
//Delete
Route::get('generate/{id}', 'GenerateController@pickUnits')->before('admin');
开发者ID:lakshyaranganath,项目名称:qpgen,代码行数:30,代码来源:routes.php

示例12: getSubjects

 public function getSubjects($category_id)
 {
     $subjects = Subject::where('category_id', '=', $category_id)->get(array('id', 'name'));
     return Response::json($subjects);
 }
开发者ID:alfonsobp,项目名称:elprofeweb,代码行数:5,代码来源:SubjectController.php


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