本文整理汇总了PHP中Question::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::where方法的具体用法?PHP Question::where怎么用?PHP Question::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function get_question($employee_id, $question_no = '')
{
$data = array();
$q = new Question();
$q->where('employee_id', $employee_id);
$q->where('question_no', $question_no);
$q->order_by('question_no');
$q->get();
return $q;
}
示例2: emaildata
function emaildata($delid)
{
$arr = array();
$ansarr = array();
$curruser = '';
$firstpass = true;
$usersandranking = Supplierrank::where('userid', '=', $delid)->with('supplier')->with('user')->orderBy('userid')->orderBy('rank')->get();
foreach ($usersandranking as $userrank) {
if ($curruser != $userrank->user->name) {
$arr[] = array();
$arr[] = array('Buyer Company Name', 'Vendor Company Name', 'Buyer Person Name', 'Buyer person designation', 'Rank');
}
$answerstable = Question::where('page', '=', 1)->with(array('answers' => function ($query) use($userrank) {
$query->where('user_id', '=', $userrank->user->id);
}))->get();
foreach ($answerstable as $answer) {
$a = '';
foreach ($answer->answers as $ans) {
$a = $ans->answer_text;
}
$ansarr[$answer->question_text] = $a;
}
$arr[] = array($ansarr['Company Name'], $userrank->supplier->name, $userrank->user->name, $ansarr['Job Title'], $userrank->rank);
$curruser = $userrank->user->name;
}
return $arr;
}
示例3: postQuestion
public function postQuestion($id)
{
$note = 0;
$qcm_student = [];
$nb_choices = Choice::where('question_id', $id)->count();
for ($i = 0; $i < $nb_choices; $i++) {
array_push($qcm_student, Input::get("status{$i}"));
}
$qcm_teacher = [];
$choices = Choice::where('question_id', $id)->get();
foreach ($choices as $choice) {
array_push($qcm_teacher, $choice->status);
}
for ($i = 0; $i < count($qcm_teacher); $i++) {
if ($qcm_teacher[$i] == $qcm_student[$i]) {
$note++;
}
}
$test_score = DB::table('scores')->where('user_id', '=', Auth::user()->id)->where('question_id', '=', Question::where('id', $id)->first()->id)->first();
if (!is_null($test_score)) {
//echo "fait";
Session::flash('message_error', 'Vous avez déjà fait ce QCM');
return Redirect::to('/student');
} else {
$score = new Score();
$score->user_id = Auth::user()->id;
$score->question_id = Question::where('id', $id)->first()->id;
$score->status_question = 'fait';
$score->note = $note;
$score->save();
Session::flash('message_success', 'Votre score a bien été enregistré');
return Redirect::to('/student');
}
return Redirect::to('/student');
}
示例4: 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);
}
示例5: questions
public function questions()
{
$questionsNonLues = Question::where('lue', '=', '0')->get();
$questionsLues = Question::where('lue', '=', '1')->get();
$countNonLues = $questionsNonLues->count();
$countLues = $questionsLues->count();
return View::make('private.pages.questions')->with('countNonLues', $countNonLues)->with('countLues', $countLues)->with('questionsNonLues', $questionsNonLues)->with('questionsLues', $questionsLues);
}
示例6: getActivity
public function getActivity()
{
$data['user'] = User::find(Auth::user()->id);
$data['userQustions'] = Question::where('user_id', '=', User::find(Auth::user()->id)->id)->orderBy('created_at', 'desc')->get();
$data['questionsCount'] = $data['userQustions']->count();
$data['userAnswers'] = Answer::where('user_id', '=', User::find(Auth::user()->id)->id)->orderBy('created_at', 'desc')->get();
$data['answersCount'] = $data['userAnswers']->count();
return View::make('profile.activity')->with($data);
}
示例7: questions
public function questions()
{
if (Auth::user()->correct_answers_count < 3) {
$result = Question::where('type', 0)->get();
} else {
if (Auth::user()->correct_answers_count == 3) {
$result = Question::where('type', 1)->get();
} else {
return Redirect::to('confirme');
}
}
$rand = rand(0, count($result) - 1);
$question = Question::with('answers')->find($result[$rand]->id);
return View::make('user.questions')->with('question', $question);
}
示例8: createAction
/**
* Create new question for the test
*
* @param $id test id
*
* @return mixed
*/
public function createAction($id)
{
$test = Test::find($id);
if (is_null($test)) {
return Redirect::route('tests.index')->with('error', 'Incorrect test id');
}
/**
* Check if we have results already
*/
if (count(Result::where('test_id', $id)->get())) {
return Redirect::route('tests.index')->with('error', 'Нельзя редактировать тест, на который есть ответы');
}
$question = new Question();
$question->test_id = $id;
$question->number = Question::where('test_id', $id)->max('number') + 1;
return View::make('question.create', ['test' => $test, 'question' => $question]);
}
示例9: run
public function run()
{
DB::table('users')->delete();
DB::table('users')->insert([['username' => 'alexandre', 'password' => Hash::make('admin'), 'role' => 'teacher'], ['username' => 'abel', 'password' => Hash::make('abel'), 'role' => 'first_class'], ['username' => 'al', 'password' => Hash::make('al'), 'role' => 'first_class'], ['username' => 'alan', 'password' => Hash::make('alan'), 'role' => 'first_class'], ['username' => 'arthur', 'password' => Hash::make('arthur'), 'role' => 'first_class'], ['username' => 'carl', 'password' => Hash::make('carl'), 'role' => 'first_class'], ['username' => 'blaise', 'password' => Hash::make('blaise'), 'role' => 'first_class'], ['username' => 'steve', 'password' => Hash::make('steve'), 'role' => 'first_class'], ['username' => 'alfred', 'password' => Hash::make('alfred'), 'role' => 'final_class'], ['username' => 'brenda', 'password' => Hash::make('brenda'), 'role' => 'final_class'], ['username' => 'tom', 'password' => Hash::make('tom'), 'role' => 'final_class'], ['username' => 'rasmus', 'password' => Hash::make('rasmus'), 'role' => 'final_class']]);
$this->command->info('remplissage des uttilisateurs : ok');
DB::table('posts')->delete();
DB::table('posts')->insert([['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'les suites récurentes', 'content' => $content = "L'étude des suites récurentes linéaires d'ordre supérieur se ramène à un problème d'algèbre linéaire.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://www.enpc.fr/sites/default/files/images/Maths_dullhunk_flickr_20111202_cc.jpg'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'développez factorisez', 'content' => $content = "développez, factorisez, Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis neque quam impedit quasi quas facere aspernatur perspiciatis, animi perferendis suscipit.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://www.rts.ch/2013/02/14/10/11/4660368.image?w=517'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'triangles trigonométriques', 'content' => $content = "Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://recit.cssamares.qc.ca/tm/images/imagesweb/Academique/MatieresRegulieres/MATH/Math7.jpg'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'les intégrales', 'content' => $content = "Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://recit.cssamares.qc.ca/tm/images/imagesweb/Academique/MatieresRegulieres/MATH/Math7.jpg'], ['user_id' => User::where('username', '=', 'alexandre')->first(), 'title' => 'Probabilités', 'content' => $content = "Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.", 'abstract' => Str::words($content, 20, '...'), 'url_thumbnail' => 'http://recit.cssamares.qc.ca/tm/images/imagesweb/Academique/MatieresRegulieres/MATH/Math7.jpg']]);
$this->command->info('remplissage des posts : ok');
DB::table('comments')->delete();
DB::table('comments')->insert([['user_id' => User::where('username', '=', 'tom')->first()->id, 'post_id' => Post::where('title', '=', 'Probabilités')->first()->id, 'title' => 'Un commentaire', 'content' => 'Lorem ipsum dolor sit amet']]);
$this->command->info('remplissage des commentaires : ok');
DB::table('questions')->delete();
DB::table('questions')->insert([$machineTuring = ['title' => 'la machine de Turing', 'content' => 'la machine de Turing c\'est quoi ?', 'class_level' => 'premiere'], $javaScript = ['title' => 'javaScript', 'content' => 'language de programation', 'class_level' => 'terminale']]);
$this->command->info('remplissage des questions : ok');
DB::table('choices')->delete();
DB::table('choices')->insert([['question_id' => Question::where('title', $machineTuring['title'])->first()->id, 'content' => 'une machine à laver', 'status' => 'no'], ['question_id' => Question::where('title', $machineTuring['title'])->first()->id, 'content' => 'une machine à voyager dans le temps', 'status' => 'no'], ['question_id' => Question::where('title', $machineTuring['title'])->first()->id, 'content' => 'un modèle abstrait de fonctionnement des appareils mécaniques de calcul', 'status' => 'yes'], ['question_id' => Question::where('title', $javaScript['title'])->first()->id, 'content' => 'un language de programation compilé', 'status' => 'no'], ['question_id' => Question::where('title', $javaScript['title'])->first()->id, 'content' => 'est utilisable uniquement sur navigateur', 'status' => 'no'], ['question_id' => Question::where('title', $javaScript['title'])->first()->id, 'content' => 'sert principalement à rendre le contenu plus intéractif', 'status' => 'yes']]);
$this->command->info('remplissage des reponses : ok');
}
示例10: voteDownQuestion
public function voteDownQuestion($qid)
{
$dbCheck = Vote::where('user_id', '=', Auth::user()->user_id)->where('question_id', '=', $qid)->first();
if ($dbCheck) {
return Redirect::route('single-question', $qid)->with('global', 'Sorry, you Previously vote this question');
} else {
$vote = new Vote();
$vote->user_id = Auth::user()->user_id;
$vote->question_id = $qid;
$vote->vote = 0;
$vote->save();
/*Insert point to the Vote user*/
$insertPoint = User::find(Auth::user()->user_id);
$insertPoint->points = $insertPoint->points - 1;
$insertPoint->save();
/*Insert point to the Question user*/
$questionuser = Question::where('id', '=', $qid)->first();
$insertPoint = User::find($questionuser->user_id);
$insertPoint->points = $insertPoint->points - 2;
$insertPoint->save();
return Redirect::route('single-question', $qid)->with('global', 'Your Successfully vote down this question');
}
}
示例11: getThankyou
public function getThankyou()
{
$page1data = Question::where('event', '=', Session::get('event'))->where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page2data = Question::where('event', '=', Session::get('event'))->where('input_type', 'checkbox')->where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
foreach ($page2data as $x) {
$project_checkbox_group[$x->question_group] = array();
foreach ($x->answers as $answer) {
$a = $answer->answer_text;
$aid = $answer->id;
}
array_push($project_checkbox_group[$x->question_group], $a);
}
//dd($project_checkbox_group);
$page3data = Question::where('event', '=', Session::get('event'))->where('page', '=', 3)->orderBy('order')->orderBy('question_group')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page4data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page5data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page6data = Question::where('event', '=', Session::get('event'))->where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
// $page1data = Question::where('page','=',1)->orderBy('order')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
// $page2data = Question::where('page','=',2)->orderBy('order')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
// $page3data = Question::where('page','=',3)->orderBy('order')->orderBy('question_group')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
// $page4data = Question::where('page','=',4)->orderBy('order')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
$vendorsstring = '';
// $pdf = PDF::loadView('reviewsendpdf',$data)->setPaper('a4')->setWarnings(false);
// return $pdf->download('test.pdf');
if (Session::get('event') == 'Healthscape series 2015') {
$html22 = View::make('forms.healthcare.reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'page5data' => $page4data, 'page6data' => $page4data));
} else {
$html22 = View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'page5data' => $page4data, 'page6data' => $page4data));
}
$html1 = "<h1>adsfadsfasdf</h1>";
// dd($html22);
require_once app_path() . '/libs/html2pdf/html2pdf.class.php';
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->WriteHTML($html22);
$htmltosend = $html2pdf->Output('', 'S');
// dd($htmltosend);
/* EMAIL NOTIFICATION FOR FILLED QUESTIONNAIRES */
$emaillists = Emaillist::where('event', '=', Auth::user()->event)->first();
$emls = explode(',', $emaillists->emails);
$emails = array();
foreach ($emls as $eml) {
$emails[$eml] = '';
}
//dd(Session::get('userid'));
$fileTblObj = fileHandler::where('user_id', '=', Session::get('userid'))->where('formPage', '=', 3)->first();
if ($fileTblObj != NULL) {
$p3path = $fileTblObj->filePath . $fileTblObj->fileName;
} else {
$p3path = NULL;
}
$fileTblObj4 = fileHandler::where('user_id', '=', Session::get('userid'))->where('formPage', '=', 4)->get();
$filesp4 = array();
foreach ($fileTblObj4 as $val) {
$filesp4[] = $val->filePath . $val->fileName;
}
//$files = File::get($p3path);
//dd($p3path);
// $emails = array(
// 'ashwin@f3seo.in' => 'Ashwin',
// //'ashwin.j@gmail.com' => 'Ashwin',
// //'sureshm@ide-global.com' => 'Suresh',
// //'ravik@ide-global.com' => 'Ravi',
// //'ganeshb@ide-global.com' => 'Ganesh',
// //'sandhya@ide-global.com' => 'Sandhya',
// //'bikash@ide-global.com' => 'Bikash',
// );
$data1 = array('asdf' => '');
Mail::send('emails.questionnairefilled', $data1, function ($message) use($htmltosend, $emails, $filesp4, $p3path) {
$message->to($emails)->from('admin@ideconnect.com')->subject(Auth::user()->name . ', ' . Auth::user()->event . '- Questionnaire completed')->attachData($htmltosend, Auth::user()->name . '_questionnaire.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment'));
if ($p3path != NULL) {
$message->attach($p3path);
}
if (count($filesp4) > 0) {
foreach ($filesp4 as $val) {
$message->attach($val);
//.........这里部分代码省略.........
示例12: Question
<?php
if (is_authen('admin_meetings')) {
?>
<a href="meetings/report/<?php
echo $meeting->id;
?>
" class="btn">ดูรายงาน</a><br /><br />
<?php
}
?>
<?php
if (mysql_to_unix($meeting->close_date) > time()) {
?>
<?php
$question = new Question();
$question->where('meeting_id', $meeting->id);
$question->where('(user_id = ' . $this->session->userdata('id') . ' or r_id = ' . $this->session->userdata('id') . ')');
$question->get();
if (!$question->exists()) {
?>
<a href="questions/form/<?php
echo $meeting->id;
?>
" class="btn">ลงทะเบียน</a>
<?php
}
?>
<?php
}
?>
</td>
示例13: getThankyou
public function getThankyou()
{
// $page1data = Question::where('event','=',Session::get('event'))->where('page','=',1)->orderBy('order')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
// $page2data = Question::where('event','=',Session::get('event'))->where('page','=',2)->orderBy('order')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
// $page3data = Question::where('event','=',Session::get('event'))->where('page','=',3)->orderBy('order')->orderBy('question_group')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
// $page4data = Question::where('event','=',Session::get('event'))->where('page','=',4)->orderBy('order')->with('choices')
// ->with(array('answers'=>function($query){
// $query->where('user_id','=',Session::get('userid'));
// }))->get();
$page1data = Question::where('page', '=', 1)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page2data = Question::where('page', '=', 2)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page3data = Question::where('page', '=', 3)->orderBy('order')->orderBy('question_group')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$page4data = Question::where('page', '=', 4)->orderBy('order')->with('choices')->with(array('answers' => function ($query) {
$query->where('user_id', '=', Session::get('userid'));
}))->get();
$categoryvendoranswers = Categoryvendoranswer::where('user_id', '=', Session::get('userid'))->with('categoryvendor')->get();
$vendorsstring = '';
if (!$categoryvendoranswers->isEmpty()) {
foreach ($categoryvendoranswers as $cva) {
if ($cva->answer == 'yes') {
$vendorsstring = $vendorsstring . $cva->categoryvendor->vendorname . ', ';
// dd($vendorsstring);
}
}
}
// $pdf = PDF::loadView('reviewsendpdf',$data)->setPaper('a4')->setWarnings(false);
// return $pdf->download('test.pdf');
$html22 = View::make('reviewsendpdf')->with(array('page1data' => $page1data, 'page2data' => $page2data, 'page3data' => $page3data, 'page4data' => $page4data, 'vendorsstring' => $vendorsstring));
$html1 = "<h1>adsfadsfasdf</h1>";
// dd($html22);
require_once app_path() . '/libs/html2pdf/html2pdf.class.php';
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->WriteHTML($html22);
$htmltosend = $html2pdf->Output('', 'S');
// dd($htmltosend);
/* EMAIL NOTIFICATION FOR FILLED QUESTIONNAIRES */
$emaillists = Emaillist::where('event', '=', Auth::user()->event)->first();
$emls = explode(',', $emaillists->emails);
$emails = array();
foreach ($emls as $eml) {
$emails[$eml] = '';
}
// $emails = array(
// 'ashwin@f3seo.in' => 'Ashwin',
// //'ashwin.j@gmail.com' => 'Ashwin',
// //'sureshm@ide-global.com' => 'Suresh',
// //'ravik@ide-global.com' => 'Ravi',
// //'ganeshb@ide-global.com' => 'Ganesh',
// //'sandhya@ide-global.com' => 'Sandhya',
// //'bikash@ide-global.com' => 'Bikash',
// );
$data1 = array('asdf' => '');
Mail::send('emails.questionnairefilled', $data1, function ($message) use($htmltosend, $emails) {
$message->to($emails)->from('admin@ideconnect.com')->subject(Auth::user()->name . ', ' . Auth::user()->event . '- Questionnaire completed')->attachData($htmltosend, Auth::user()->name . '_questionnaire.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment'));
});
/*******************************************/
// $pdf = App::make('dompdf');
// $pdf->loadHTML($html)->setPaper('a4')->setWarnings(false);
// return $pdf->stream();
return View::make('forms.thankyou');
}
示例14: adminBearbeite
public function adminBearbeite()
{
$qid = Input::get("qid");
$questions = Question::where('questionnaire_id', '=', $qid)->get();
foreach ($questions as $q) {
$q->questionnaire_id = $qid;
$fieldname = "field" . $q->id;
$q->question = Input::get($fieldname);
$q->save();
if ($q->question == "x") {
$q->delete();
}
}
$questions = Question::where('questionnaire_id', '=', $qid)->get();
return Redirect::to('adminstart/admin');
}
示例15: userQuestionCount
public static function userQuestionCount($uid)
{
$qCount = Question::where('user_id', '=', $uid);
return $qCount->count();
}