本文整理汇总了PHP中Poll::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::where方法的具体用法?PHP Poll::where怎么用?PHP Poll::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::where方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_view
public static function action_view($slug)
{
if (!($poll = Poll::where('slug', '=', $slug)->first())) {
return Response::error(404);
}
return View::make('home.view')->add_var('poll', $poll)->add_var('answers', Answer::where('poll_id', '=', $poll->id)->get());
}
示例2: show
/**
* Display the specified resource.
* GET /frontend/publiccontact/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
try {
$contact = Contact::findOrFail($id);
$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'))->distinct('permalink')->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('published', '=', 2)->where('post_type', '=', 1)->groupBy('permalink')->orderBy('news.created_at', 'desc')->take(10)->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', $contact->title . " " . $contact->first_name . " " . $contact->last_name . " | Пушкице | Тачка спајања студената ФОН-а");
$ogimage = Puskice::firstContactImage($contact);
$meta = "\t<meta property='og:image' content='" . $ogimage . "'/>\n\t\t\t\t\t\t<meta property='og:title' content='" . __($contact->title . " " . $contact->first_name . " " . $contact->last_name . " | Пушкице | Тачка спајања студената ФОН-а") . "'/>\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() . "/ljudi/" . $contact->id) . "'/>\n\t\t\t\t\t\t<meta property='og:description' content='" . __($contact->description) . "' />\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='" . __($contact->title . " " . $contact->first_name . " " . $contact->last_name . " | Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:description' content='" . __($contact->description) . "'>\n\t\t\t\t\t\t<meta name='twitter:image' content='" . $ogimage . "'>";
$data = array('articles' => $articles, 'featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'meta' => $meta, 'contact' => $contact);
$this->setLayout($data);
$this->layout->center = View::make('frontend.content.contact', $data);
} catch (Exception $e) {
App::abort(404);
}
}
示例3: getShowResults
public function getShowResults($id)
{
try {
$this->googleAnalytics('/polls/show-results/' . $id);
$poll = Poll::where('id', '=', $id)->firstOrFail();
$poll->title = __($poll->title);
foreach ($poll->pollOptions as $key => $option) {
$poll->pollOptions[$key]->title = __($poll->pollOptions[$key]->title);
}
return Response::json(array('status' => 'success', 'poll' => $poll));
} catch (Exception $e) {
return Response::json(array('status' => 'fail'));
}
}
示例4: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
if (Session::get('user_level') < Config::get('cms.viewPolls')) {
return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning');
}
$this->setLayout();
if (Input::get('q')) {
$polls = Poll::where('title', 'LIKE', '%' . Input::get('q') . '%')->orderBy('created_at', 'desc')->paginate(20);
} else {
$polls = Poll::orderBy('created_at', 'desc')->paginate(20);
}
View::share('title', Lang::get('admin.polls'));
View::share('polls', $polls);
$this->layout->content = View::make('backend.polls.index');
}
示例5: newPoll
public function newPoll()
{
$title = Input::get('title');
$already_created = Poll::where('title', 'like', '%' . $title . '%');
if (!($already_created->count() > 0)) {
if (isset($title)) {
$poll = Poll::create(array('title' => $title, 'created_by' => Auth::user()->id));
$poll->save();
return null;
}
} else {
return Response::json(array('title' => $already_created->first()->title));
}
//return Response::json($return);
}
示例6: newMeme
public function newMeme()
{
$title = "Нови постер | Пушкице";
View::share('title', strip_tags($title));
$memes = Meme::all();
Session::put('antispam1', rand(0, 20));
Session::put('antispam2', rand(0, 20));
//$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;
}
$meta = "\t<meta property='og:image' content='" . Config::get('settings.defaultImg') . "'/>\n\t\t\t\t\t\t<meta property='og:title' content='" . __("Меме генератор | Пушкице | Тачка спајања студената ФОН-а") . "'/>\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() . "/memes/new") . "'/>\n\t\t\t\t\t\t<meta property='og:description' content='" . __("Меме генератор | Пушкице") . "' />\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='" . __("Меме генератор | Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:description' content='" . __(strip_tags("Меме генератор")) . "'>\n\t\t\t\t\t\t<meta name='twitter:image' content='" . Config::get('settings.defaultImg') . "'>";
$data = array('featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'meta' => $meta, 'memes' => $memes);
$this->setLayout($data);
$this->layout->center = View::make('frontend.content.newMeme', $data);
}
示例7: postKviz
public function postKviz()
{
$rules = array('kadsuculi' => 'Required', 'vladar' => 'Required', 'zgrada' => 'Required', 'konasvoli' => 'Required', 'nikadniste' => 'Required', 'promene' => 'Required', 'stavoli' => 'Required', 'epsilon' => 'Required', 'clan' => 'Required', 'biliclan' => 'Required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to(_l(URL::to('/') . '/kviz'))->withErrors($validator)->withInput();
} else {
$kviz = new Kviz();
$kviz->kadsuculi = Input::get('kadsuculi');
$kviz->vladar = is_array(Input::get('vladar')) ? serialize(Input::get('vladar')) : '';
$kviz->zgrada = Input::get('zgrada');
$kviz->konasvoli = is_array(Input::get('konasvoli')) ? serialize(Input::get('konasvoli')) : '';
$kviz->nikadniste = is_array(Input::get('nikadniste')) ? serialize(Input::get('nikadniste')) : '';
$kviz->promene = Input::get('promene');
$kviz->stavoli = is_array(Input::get('stavoli')) ? serialize(Input::get('stavoli')) : '';
$kviz->epsilon = Input::get('epsilon');
$kviz->biliclan = Input::get('biliclan');
$kviz->clan = is_array(Input::get('clan')) ? serialize(Input::get('clan')) : '';
$kviz->save();
try {
$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();
$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();
$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();
$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', "Квиз | Пушкице");
$ogimage = Config::get('settings.defaultImage');
$meta = "\t<meta property='og:image' content='" . $ogimage . "'/>\n\t\t\t\t\t\t\t<meta property='og:title' content='" . __("Квиз | Пушкице") . "'/>\n\t\t\t\t\t\t\t<meta property='fb:app_id' content='355697367892039'/>\n\t\t\t\t\t\t\t<meta property='og:site_name' content='" . __("Пушкице - ФОН Андерграунд") . "'/>\n\t\t\t\t\t\t\t<meta property='og:type' content='article'/>\n\t\t\t\t\t\t\t<meta property='og:url' content='" . _l(Request::root() . "/kviz/") . "'/>\n\t\t\t\t\t\t\t<meta property='og:description' content='" . __("Квиз за ФОН-овце") . "' />\n\t\t\t\t\t\t\t<meta name='twitter:card' content='summary_large_image'>\n\t\t\t\t\t\t\t<meta name='twitter:site' content='" . __("Пушкице - ФОН Андерграунд") . "'>\n\t\t\t\t\t\t\t<meta name='twitter:creator' content='@puskice'>\n\t\t\t\t\t\t\t<meta name='twitter:domain' content='puskice.org'>\n\t\t\t\t\t\t\t<meta name='twitter:app:name:iphone' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t\t<meta name='twitter:app:name:ipad' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t\t<meta name='twitter:title' content='" . __("Квиз | Пушкице") . "'>\n\t\t\t\t\t\t\t<meta name='twitter:description' content='" . __("Квиз за ФОН-овце") . "'>\n\t\t\t\t\t\t\t<meta name='twitter:image' content='" . $ogimage . "'>";
$data = array('articles' => $articles, 'featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'kviz' => $kviz, 'meta' => $meta);
$this->setLayout2($data);
$this->layout->boxes = View::make('frontend.boxes', $data);
$this->layout->imageOfTheWeek = View::make('frontend.sidebar.imageOfTheWeek', $data);
$this->layout->didYouKnow = View::make('frontend.sidebar.didYouKnow', $data);
$this->layout->twitter = View::make('frontend.sidebar.twitter');
$this->layout->poll = View::make('frontend.sidebar.poll', $data);
$this->layout->center = View::make('frontend.content.kvizKraj', $data);
} catch (Exception $e) {
return App::abort(404);
}
}
}
示例8: getMyProfile
public function getMyProfile()
{
try {
View::share('title', "Моје Пушкице | Пушкице | Тачка спајања студената ФОН-а");
$user = User::findOrFail(Session::get('id'));
$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'))->distinct('permalink')->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('published', '=', 2)->where('post_type', '=', 1)->groupBy('permalink')->orderBy('news.created_at', 'desc')->take(10)->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;
}
$ogimage = Config::get('settings.defaultImage');
$meta = "\t<meta property='og:image' content='" . $ogimage . "'/>\n\t\t\t\t\t\t<meta property='og:title' content='" . __("Моје Пушкице | Пушкице | Тачка спајања студената ФОН-а") . "'/>\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() . "/login/my-profile") . "'/>\n\t\t\t\t\t\t<meta property='og:description' content='" . __("Креирајте свој профил на Пушкицама и остварите приступ бројним погодностима које нудимо студентима") . "' />\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='" . __("Моје Пушкице | Пушкице | Тачка спајања студената ФОН-а") . "'>\n\t\t\t\t\t\t<meta name='twitter:description' content='" . __("Креирајте свој профил на Пушкицама и остварите приступ бројним погодностима које нудимо студентима") . "'>\n\t\t\t\t\t\t<meta name='twitter:image' content='" . $ogimage . "'>";
$data = array('articles' => $articles, 'featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'meta' => $meta, 'user' => $user);
$this->setLayout($data);
$this->layout->center = View::make('frontend.content.profile', $data);
//$this->layout->carousel = View::make('frontend.carousel', $data);
$this->layout->boxes = View::make('frontend.boxes', $data);
$this->layout->imageOfTheWeek = View::make('frontend.sidebar.imageOfTheWeek', $data);
$this->layout->didYouKnow = View::make('frontend.sidebar.didYouKnow', $data);
$this->layout->twitter = View::make('frontend.sidebar.twitter');
$this->layout->poll = View::make('frontend.sidebar.poll', $data);
} catch (Exception $e) {
return Redirect::to('login')->with('message', __("Потребно је да се прво улогујете"))->with('notif', 'success');
}
}