本文整理匯總了PHP中Student::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Student::where方法的具體用法?PHP Student::where怎麽用?PHP Student::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Student
的用法示例。
在下文中一共展示了Student::where方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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));
}
示例2: feedback
public function feedback()
{
$writer = Student::where('auth', '=', Input::get('auth'))->first();
$feedClass = Input::get('class');
$commit = Input::get('commit');
$system = Input::get('system');
$feedback = new Feedback();
$feedback->feedClass = $feedClass;
$feedback->commit = $commit;
$feedback->stu_id = $writer->id;
$feedback->system = $system;
$feedback->checked = 0;
$feedback->save();
return "suc";
}
示例3: index
public function index()
{
$id = Auth::id();
$student = Student::where('id_user', '=', $id)->get()->first();
$teacher = Teacher::where('id_user', '=', $id)->get()->first();
if (isset($student)) {
return View::make('users.hello', compact('student'));
//
} else {
if (isset($teacher)) {
return View::make('users.hello', compact('teacher'));
//
}
}
}
示例4: forumIdWrite
public function forumIdWrite($id)
{
$json = Input::get('json');
$data = json_decode($json);
$writer = Student::where('auth', '=', $data->auth)->first();
$sn = Topic::max('sn') + 1;
$body = base64_decode($data->body);
$topics = Topic::find($id);
$topics->sn = $sn;
$topics->save();
$commit = new Commit();
$commit->stu_id = $writer->id;
$commit->topic_id = $id;
$commit->body = $body;
$commit->day = date("Y/m/d");
$commit->save();
return "suc";
}
示例5: showCalendar
public function showCalendar($wingman_id, $student_id)
{
$this->setGroup();
$city = Wingman::find($wingman_id)->city()->first();
$volunteers = Group::where('name', $this->asvGroupName)->first()->volunteer()->where('city_id', '=', $city->id)->where('status', '=', 1)->where('user_type', '=', 'volunteer')->groupby('id')->get();
//return $volunteers;
$subjects = Wingman::find($wingman_id)->city()->first()->subject()->get();
$wingman_modules = WingmanModule::all();
/*$calendarEvents = DB::table('propel_calendarEvents as P')->select('P.id','P.type as title','P.start_time as start','P.end_time as end')->where('student_id','=',$student_id)->get();
*/
$calendarEvents = DB::table('propel_calendarEvents as P')->leftJoin('propel_cancelledCalendarEvents as Q', 'P.id', '=', 'Q.calendar_event_id')->leftJoin('propel_wingmanTimes as R', 'R.calendar_event_id', '=', 'P.id')->leftJoin('propel_volunteerTimes as S', 'S.calendar_event_id', '=', 'P.id')->leftJoin('User as T', 'T.id', '=', 'S.volunteer_id')->leftJoin('User as U', 'U.id', '=', 'R.wingman_id')->leftJoin('propel_wingmanModules as V', 'V.id', '=', 'R.wingman_module_id')->leftJoin('propel_subjects as W', 'W.id', '=', 'S.subject_id')->select('P.id', 'P.type as title', 'P.start_time as start', 'P.end_time as end', 'P.status', 'Q.reason as reason', 'Q.comment as comment', 'U.name as wingman_name', 'T.name as volunteer_name', 'S.volunteer_id as volunteer_id', 'R.wingman_id as wingman_id', 'V.id as module_id', 'W.id as subject_id', 'V.name as module_name', 'W.name as subject_name')->where('student_id', '=', $student_id)->get();
foreach ($calendarEvents as $calendarEvent) {
$calendarEvent->title = str_replace('_', ' ', $calendarEvent->title);
$calendarEvent->title = ucwords($calendarEvent->title);
$calendarEvent->reason = str_replace('_', ' ', $calendarEvent->reason);
$calendarEvent->reason = ucwords($calendarEvent->reason);
}
$calendarEvents = json_encode($calendarEvents);
$student_name = Student::where('id', '=', $student_id)->first();
$GLOBALS['student_id'] = $student_id;
return View::make('calendar.calendar-view')->with('volunteers', $volunteers)->with('subjects', $subjects)->with('wingman_modules', $wingman_modules)->with('student_id', $student_id)->with('wingman_id', $wingman_id)->with('calendarEvents', $calendarEvents)->with('student_name', $student_name->name);
}
示例6: postGuardar
public function postGuardar()
{
$bandera = false;
$id = Input::get('idQues');
$ans = Input::get('res');
$answers = Answer::all();
$question = Question::find($id);
$cantidad = Question::count();
foreach ($answers as $a) {
if ($a->id_question == $id) {
$bandera = true;
$answer = $a;
break;
}
}
if (!$bandera) {
$answer = new Answer();
$answer->id_question = $id;
$ids = Auth::id();
$student = Student::where('id_user', '=', $ids)->get()->first();
$answer->id_student = $student->id;
$answer->answer = $ans;
$answer->result = QuestionsController::verifyAnswer($question, $ans);
$answer->save();
} else {
$answer->result = QuestionsController::verifyAnswer($question, $ans);
$answer->answer = $ans;
$answer->save();
}
if ($cantidad == $id) {
return Redirect::to('questions/exam?endTest=yes');
//"holi ".$id." ".$ans;
} else {
if ($cantidad > $id) {
return Redirect::to('questions/exam?numberQIn=' . ++$id);
}
}
}
示例7: 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
示例8: search
public static function search($search_text, $search_state, $search_level)
{
$first_filter = Student::where('names', 'LIKE', "%{$search_text}%")->orWhere('lastname', 'LIKE', "%{$search_text}%")->whereNull('deleted_at');
//if($search_state=='T') return $first_filter;
$students = $first_filter->get();
$second_filter = [];
foreach ($students as $student) {
$enrollment = $student->getCurrentEnrollment();
if ($enrollment) {
if ($search_state == 'T' || $search_state == $enrollment->state) {
if ($search_level == '0' || $search_level == $enrollment->level_id) {
$second_filter[] = $student->id;
}
}
} else {
if ($search_state == 'T' || $search_state == 'N') {
if ($search_level == '0' || $search_level == $student->getLevelToEnroll()->id) {
$second_filter[] = $student->id;
}
}
}
}
return Student::whereIn('id', $second_filter);
}
示例9: get
public function get($id)
{
$user = \Student::where('id', '=', $id)->first();
//$user = $this->model->where('id', '=', $id)->first();
return $user->name;
}
示例10: 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('/', 'UsersController@login');
Route::get('/login', 'UsersController@login');
Route::post('/login', 'UsersController@authenticate');
Route::get('logs', '\\Rap2hpoutre\\LaravelLogViewer\\LogViewerController@index');
// Route::get('/modules/marks-input/create','ModulesController@markInputCreate');
Route::get('/test', function () {
$x = Student::where('san', '=', 'khpsh001')->first();
return $x->id;
});
Route::get('/teststudents', 'StudentsController@teststudents');
// Route::post('/modules/marks-input/create','ModulesController@saveMarkInputs');
Route::group(array('before' => 'members_auth'), function () {
Route::post('/modules/supervisor-allocation', 'ModuleSupervisorAllocationsController@assign_supervisor');
//Route::post('/modules/supervisor-allocation','ModuleMarkerAllocationsController@assign_marker');
Route::get('/testpage', function () {
return View::make('test');
});
Route::get('/logout', 'UsersController@logout');
Route::get('/help', 'UsersController@logout');
Route::get('students/create/checkSanAvailability', 'StudentsController@checkSanAvailability');
Route::get('students/create/information_source/dropdown', 'StudentsController@information_source_dropdown');
Route::get('students/create/intakes/dropdown', 'StudentsController@intakes_dropdown');
示例11: getAllActive
public function getAllActive()
{
return Student::where('is_active', '=', 1)->with('secondary', 'secondary.grade', 'secondary.school', 'secondary.schoolboard')->orderBy('last_name')->remember(60)->get();
}
示例12: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$rules = ['regiNo' => 'required', 'fname' => 'required', 'lname' => 'required', 'gender' => 'required', 'religion' => 'required', 'bloodgroup' => 'required', 'nationality' => 'required', 'dob' => 'required', 'session' => 'required', 'class' => 'required', 'section' => 'required', 'rollNo' => 'required', 'shift' => 'required', 'photo' => 'required|mimes:jpeg,jpg,png', 'fatherName' => 'required', 'fatherCellNo' => 'required', 'motherName' => 'required', 'motherCellNo' => 'required', 'presentAddress' => 'required', 'parmanentAddress' => 'required'];
$validator = \Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('/student/create')->withErrors($validator);
} else {
$fileName = Input::get('regiNo') . '.' . Input::file('photo')->getClientOriginalExtension();
$student = new Student();
$student->regiNo = Input::get('regiNo');
$student->firstName = Input::get('fname');
$student->middleName = Input::get('mname');
$student->lastName = Input::get('lname');
$student->gender = Input::get('gender');
$student->religion = Input::get('religion');
$student->bloodgroup = Input::get('bloodgroup');
$student->nationality = Input::get('nationality');
$student->dob = Input::get('dob');
$student->session = trim(Input::get('session'));
$student->class = Input::get('class');
$student->section = Input::get('section');
$student->group = Input::get('group');
$student->rollNo = Input::get('rollNo');
$student->shift = Input::get('shift');
$student->photo = $fileName;
$student->nationality = Input::get('nationality');
$student->extraActivity = Input::get('extraActivity');
$student->remarks = Input::get('remarks');
$student->fatherName = Input::get('fatherName');
$student->fatherCellNo = Input::get('fatherCellNo');
$student->motherName = Input::get('motherName');
$student->motherCellNo = Input::get('motherCellNo');
$student->localGuardian = Input::get('localGuardian');
$student->localGuardianCell = Input::get('localGuardianCell');
$student->presentAddress = Input::get('presentAddress');
$student->parmanentAddress = Input::get('parmanentAddress');
$student->isActive = "Yes";
$hasStudent = Student::where('regiNo', '=', Input::get('regiNo'))->where('class', '=', Input::get('class'))->first();
if ($hasStudent) {
$messages = $validator->errors();
$messages->add('Duplicate!', 'Student already exits with this registration no.');
return Redirect::to('/student/create')->withErrors($messages)->withInput();
} else {
$student->save();
Input::file('photo')->move(base_path() . '/public/images', $fileName);
return Redirect::to('/student/create')->with("success", "Student Admited Succesfully.");
}
}
}
示例13: findMemberInformation
public function findMemberInformation()
{
if (Request::ajax()) {
$student = Student::where('email', Input::get('email'))->first();
return Response::json($student);
}
}
示例14: function
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function () {
if (Auth::check()) {
return Redirect::to('/');
}
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::token() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException();
}
});
Route::filter('stu_login', function () {
$auth = Input::get("auth");
if (Student::where("auth", "=", $auth)->count() == 0) {
return "Not User";
}
});
示例15: postEditVoter
public function postEditVoter()
{
//verify the user input
$validator = Validator::make(Input::all(), array('Faculty' => '', 'Residence' => ''));
if ($validator->fails()) {
return Redirect::route('admin-view-voters-get')->with('globalerror', 'Please Try Again');
} else {
$voter_id = Input::get('Voter_ID');
$voter = Student::where('id', '=', $voter_id)->first();
$faculty = Input::get('Faculty');
$residence = Input::get('Residence');
$voter->Faculty = $faculty;
$voter->Redidence = $residence;
if ($voter->save()) {
return Redirect::route('admin-view-voters-get')->with('globalsuccess', 'Voter Details have been edited');
}
}
}