本文整理汇总了PHP中Pages::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::where方法的具体用法?PHP Pages::where怎么用?PHP Pages::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($args = NULL)
{
parent::render($args);
$this->template->content = $this->pages->where('code', $this->actual)->fetch();
$this->template->setFile(__DIR__ . "/Page.latte");
$this->template->render();
}
示例2: getOrder
public function getOrder()
{
$pages = Pages::where('id_parent', '=', 0)->orderBy('order', 'ASC')->get();
foreach ($pages as $item) {
# code...
$item->label = $item->title;
}
$args = array('route' => $this->route, 'pages' => $pages, 'json' => json_encode($pages));
return View::make('backend.pages.order')->with($args);
}
示例3: getCadastro
public function getCadastro()
{
$page = Pages::where('name', '=', 'cadastro')->take(1)->get();
if (isset($page[0])) {
$page = $page[0];
} else {
$page = false;
}
$args = array('route' => self::$route, 'page' => $page);
return View::make('auth.cadastro')->with($args);
}
示例4: login
public function login($language)
{
// Définition de la langue :
if (!$this->setupLanguage($language)) {
App::abort(404);
}
try {
$languages = Language::where('_url', '=', $language)->firstOrFail();
$page = Pages::where('_language', $languages->_id)->where("_name", "=", "user/login")->get()->first();
} catch (Exception $e) {
App::abort(500);
}
// Redirection de l'utilisateur s'il est déjà connecté :
if (Auth::check()) {
return Redirect::to(URL::to($language . '/home'));
}
// Variables :
// Details :
$data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => ""));
// Message :
$message = "";
// Inputs :
$login = "";
$password = "";
// Envoi du formulaire de connexion :
if (count(Input::all()) > 0) {
// récupération des inputs :
$login = htmlentities(Input::get('your-login'));
$password = htmlentities(Input::get('your-password'));
// validation des formulaire :
$validator = Validator::make(array('email' => $login, 'password' => $password), array('email' => 'required|email', 'password' => 'required'), array('email.required' => Lang::get('libelle.CONNEXION_ERROR_IDENTIFIANT_RQ'), 'email.email' => Lang::get('libelle.CONNEXION_ERROR_IDENTIFIANT_INV'), 'password.required' => Lang::get('libelle.CONNEXION_ERROR_PASSWORD_RQ')));
// retour en cas d'erreur :
if ($validator->fails()) {
$message = $validator->messages();
} else {
// connexion en cas de succès :
$auth = Users::where('_email', '=', $login)->where('_password', '=', md5($password))->first();
// si utilisateur trouvé, redirection :
if ($auth) {
Auth::login($auth);
Auth::user()->_ipLastConnection = Request::getClientIp(true);
Auth::user()->_dateLastConnection = date("Y-m-d H:i:s");
Auth::user()->save();
return Redirect::to(URL::to($language . '/home'));
} else {
$message = Lang::get("libelle.CONNEXION_ERROR");
}
}
}
// Renvoi de la vue avec les message(s) d'erreurs :
$page = $this->layout->content = View::make('pages.users.login', array("data" => $data, "page" => $page, "message" => $message));
return Response::make($page, '200');
}
示例5: index
public function index()
{
if (CNF_FRONT == 'false' && Request::segment(1) == '') {
return Redirect::to('dashboard');
}
if (is_null(Input::get('p'))) {
$page = Request::segment(1);
} else {
$page = Input::get('p');
}
if ($page != '') {
$content = Pages::where('alias', '=', $page)->where('status', '=', 'enable');
if ($content->count() >= 1) {
$content = $content->get();
$row = $content[0];
$this->data['pageTitle'] = $row->title;
$this->data['pageNote'] = $row->note;
$this->data['breadcrumb'] = 'active';
if ($row->access != '') {
$access = json_decode($row->access, true);
} else {
$access = array();
}
// If guest not allowed
if ($row->allow_guest != 1) {
$group_id = Session::get('gid');
$isValid = isset($access[$group_id]) && $access[$group_id] == 1 ? 1 : 0;
if ($isValid == 0) {
return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
}
}
if ($row->template == 'backend') {
$this->layout = View::make("layouts.main");
}
$filename = public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php";
if (file_exists($filename)) {
$page = 'pages.template.' . $row->filename;
} else {
return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_noexists')));
}
} else {
return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_noexists')));
}
} else {
$this->data['pageTitle'] = 'Home';
$this->data['pageNote'] = 'Welcome To Our Site';
$this->data['breadcrumb'] = 'inactive';
$page = 'pages.template.home';
}
$page = SiteHelpers::renderHtml($page);
$this->layout->nest('content', $page, $this->data)->with('menus', $this->menus)->with('page', $this->data);
}
示例6: news
public function news($language)
{
// Définition de la langue :
if (!$this->setupLanguage($language)) {
App::abort(404);
}
// Variables :
// News (dans un try catch pour gérer les erreurs) :
try {
$languages = Language::where('_url', '=', $language)->firstOrFail();
$page = Pages::where('_language', $languages->_id)->where("_name", "=", "news")->get()->first();
$news = News::where('_langue', '=', $languages->_id)->get();
$news = $news->sortBy('_date')->take(15);
} catch (Exception $e) {
App::abort(500);
}
// Details :
$data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => ""));
// Renvoi de la vue avec les news :
$page = $this->layout->content = View::make('pages.news.news', array("data" => $data, "page" => $page, "news" => $news));
return Response::make($page);
}
示例7: search
public function search($language)
{
if (!$this->setupLanguage($language)) {
App::abort(404);
}
// VARIABLES :
// Pages :
try {
$languages = Language::where('_url', '=', $language)->firstOrFail();
$page = Pages::where('_language', $languages->_id)->where("_name", "=", "search")->get()->first();
} catch (Exception $e) {
App::abort(500);
}
// Request :
$accentARemplacer = array('Š' => 'S', 'š' => 's', 'Ž' => 'Z', 'ž' => 'z', 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'A', 'Ç' => 'C', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ý' => 'Y', 'Þ' => 'B', 'ß' => 'Ss', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'a', 'ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ð' => 'o', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ý' => 'y', 'ý' => 'y', 'þ' => 'b', 'ÿ' => 'y');
$request = trim(Input::get("q"));
$requestWithoutAccent = strtr($request, $accentARemplacer);
$requestWithAccent = $request;
$request_explode = array_unique(array_merge(explode(" ", $requestWithoutAccent), explode(" ", $requestWithAccent)));
// Details :
$data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => " ", $request => ""));
//
$results = array();
if (count($request_explode) > 0) {
foreach ($request_explode as $key => $value) {
$pages = Pages::where("_keywords", "LIKE", '%' . $value . '%')->orWhere('_title', "LIKE", '%' . $value . '%')->orWhere('_name', "LIKE", '%' . $value . '%')->orWhere('_description', "LIKE", '%' . $value . '%')->get();
$news = News::where('_langue', '=', $languages->_id)->where("_extract", "LIKE", '%' . $value . '%')->orWhere('_content', "LIKE", '%' . $value . '%')->orWhere('_title', "LIKE", '%' . $value . '%')->get();
if (count($pages) > 0) {
$results["pages"] = $pages;
}
if (count($news) > 0) {
$results["news"] = $news;
}
}
} else {
App::abort(404);
}
$this->layout->content = View::make('pages.search.search', array('data' => $data, "page" => $page, "language" => $languages, 'request' => $request, 'results' => $results));
}
示例8: function
$page->page_section = Input::get('page_section');
$page->page_link_value = $section->shortname . "/" . Input::get('page_shortname');
$page->color_code = Input::get('color_code');
$page->page_shortname = Input::get('page_shortname');
$page->page_url = $xmlFileName;
//
$page->save();
}
return Redirect::to('/add')->withMessage('Page created successfully');
});
Route::post('addPageDetails', function () {
if (Input::hasFile('image')) {
$image = Input::file('image');
$name = $image->getClientOriginalName();
}
$oldPage = Pages::where('id', '=', Input::get('id'))->first();
if (File::exists($oldPage->page_url)) {
File::delete($oldPage->page_url);
}
$rule = array('page_description' => 'required', 'page_name' => 'required', 'page_title' => 'required', 'page_subtitle' => 'required', 'type_of_page' => 'required', 'page_section' => 'required', 'page_shortname' => 'required');
$validator = Validator::make(Input::all(), $rule);
if ($validator->fails()) {
return Redirect::to('/forms')->with('flash_error', 'true')->withInput()->withErrors($validator);
} else {
$first_action_cnt = Input::get('first_action_cnt');
$second_action_cnt = Input::get('second_action_cnt');
$transport_action_cnt = Input::get('transport_cnt');
$action_cnt = Input::get('action_cnt');
$question_cnt = Input::get('question_cnt');
$layout_cnt = Input::get('layout_cnt');
$noreferral_cnt = Input::get('noreferral_cnt');
示例9: count
<div class="captionCustomize">
<a class="captionCustomize" alt="QLM Label Makers" title="QLM Label Makers">coming soon</a>
</div>
</div>
</div>
@endfor
@endif
</div>
<!-- end of Part 1 -->
@endif
<?php
//-- sub menu va co danh sach con detail type la 2.
$_resultPageDetail = Pages::where('detailURL', $_page->detailParent)->where('detailType', '2')->get();
if (count($_resultPageDetail) > 0) {
$_detailParent2 = $_resultPageDetail[0]->detailParent;
$lst_buttons_level2 = Pages::where('detailParent', $_detailParent2)->where('detailType', '2')->get();
if (count($lst_buttons_level2) > 0) {
$cnt_buttons_level2 = count($lst_buttons_level2);
$afterCheck = 1;
$preCheck = 1;
//-- neu so luong khong chia het cho 4.
if ($cnt_buttons_level2 % 4 != 0) {
while (($cnt_buttons_level2 + $preCheck) % 4 > 0) {
$preCheck++;
}
$afterCheck = $preCheck + 1;
}
}
}
?>
示例10: addMission
public function addMission($language)
{
// Définition de la langue :
if (!$this->setupLanguage($language)) {
App::abort(404);
}
// Redirection de l'utilisateur s'il est pas connecté et s'il n'est pas Admin:
if (!Auth::check()) {
return Redirect::to(URL::to($language . '/home'));
} elseif (Auth::User()->_level != "admin") {
return Redirect::to(URL::to($language . '/missions'));
}
// Variables :
// Missions :
$languages = Language::where('_url', '=', $language)->firstOrFail();
$page = Pages::where('_language', $languages->_id)->where("_name", "=", "missions")->get()->first();
$missions = Missions::where("_dateEnd", ">=", date("Y-m-d 00:00:00"))->orderBy('_dateStart')->orderBy('_dateEnd')->get();
// Form :
$inputs = Input::all();
$result = array();
// Details :
$data = array("situation" => array("title" => $page->_title, "description" => $page->_description), "position" => array($page->_title => ""));
// Envoi du formulaire d'ajout de mission :
if (count(Input::all()) > 0) {
// validation des formulaire :
$validator = Validator::make($inputs, array('professor-name' => 'required|max:60', 'professor-email' => 'required|email|max:60', 'manager-name' => 'required|max:60', 'manager-email' => 'required|email|max:60', 'professor-mission-start' => 'required|date_format:"Y-m-d"|after:"now -1 day"', 'professor-mission-end' => 'required|date_format:"Y-m-d"|after:"' . strtotime("professor-mission-start") . '"', 'your-message' => 'required', 'liaison-file' => 'mimes:jpg,jpeg,png,doc,docx,pdf'), array('professor-name.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_NAME_RQ'), 'professor-name.max' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_NAME_MAX'), 'professor-email.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_EMAIL_RQ'), 'professor-email.email' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_EMAIL_INV'), 'professor-email.max' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_EMAIL_MAX'), 'manager-name.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_MANAGER_NAME_RQ'), 'manager-name.max' => Lang::get('libelle.MISSIONS_FORM_ERROR_MANAGER_NAME_MAX'), 'manager-email.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_MANAGER_EMAIL_RQ'), 'manager-email.email' => Lang::get('libelle.MISSIONS_FORM_ERROR_MANAGER_EMAIL_INV'), 'manager-email.max' => Lang::get('libelle.MISSIONS_FORM_ERROR_MANAGER_EMAIL_MAX'), 'professor-mission-start.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_MISSION_START_RQ'), 'professor-mission-start.date_format' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_MISSION_START_INV'), 'professor-mission-start.after' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_MISSION_START_INV'), 'professor-mission-end.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_MISSION_END_RQ'), 'professor-mission-end.date_format' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_MISSION_END_INV'), 'professor-mission-end.after' => Lang::get('libelle.MISSIONS_FORM_ERROR_PROFESSEUR_MISSION_END_INV'), 'your-message.required' => Lang::get('libelle.MISSIONS_FORM_ERROR_MESSAGE'), 'liaison-file.mimes' => Lang::get('libelle.MISSIONS_FORM_ERROR_LIAISON_FILE')));
// retour en cas d'erreur :
if ($validator->fails()) {
$result["errors"] = $validator->messages();
} else {
// traitement du texte en paragraphe
$texte = explode('<br />', nl2br(trim(htmlentities($inputs['your-message']))));
$inputs['your-message'] = "";
foreach ($texte as $key => $value) {
$inputs['your-message'] .= "<p>" . $value . "</p>";
}
// ajout en cas de succès :
$mission = new Missions();
$mission->_author = 1;
$mission->_dateStart = trim(htmlentities($inputs['professor-mission-start']));
$mission->_dateEnd = trim(htmlentities($inputs['professor-mission-end']));
$mission->_profName = trim(htmlentities($inputs['professor-name']));
$mission->_profMail = trim(htmlentities($inputs['professor-email']));
$mission->_ctdName = trim(htmlentities($inputs['manager-name']));
$mission->_ctdMail = trim(htmlentities($inputs['manager-email']));
$mission->_description = $inputs['your-message'];
if (Input::hasFile('liaison-file')) {
$filename = date("YmdHis") . "-" . Input::file('liaison-file')->getClientOriginalName();
Input::file('liaison-file')->move(dirname("app/storage/uploads/missions/") . "/missions/", $filename);
$mission->_file = "storage/uploads/missions/" . $filename;
}
// enrgistrement en base de données.
if ($mission->save()) {
// actualisation des missions :
$missions = Missions::where("_dateEnd", ">=", date("Y-m-d 00:00:00"))->orderBy('_dateStart')->orderBy('_dateEnd')->get();
// vidage du formulaire :
foreach ($inputs as $key => $value) {
$inputs[$key] = "";
}
// affichage du message de reussite :
$result["success"] = Lang::get("libelle.MISSIONS_FORM_SUCCESS");
} else {
$result["errors"] = Lang::get("libelle.MISSIONS_FORM_ERROR");
}
}
}
// Affichage de la vue avec retour du résultat de l'ajout :
$this->layout->content = View::make('pages.missions.missions', array("data" => $data, "page" => $page, "missions" => $missions, "inputs" => $inputs, "result" => $result));
}
示例11: page
static function page($slug)
{
$page = Pages::where('slug', '=', $slug)->first();
$page = Pages::find($page->id);
return $page;
}
示例12: update_page
public function update_page()
{
try {
$_arData = array();
$total_files = null;
$detailType = Input::get("detailType");
$detailName = Input::get("detailName");
$detailTitle = Input::get("detailTitle");
$detailUrl = Input::get("detailUrl");
$detailParent = Input::get("detailParent");
$detailContent = Input::get("detailContent");
$detailVisible = Input::get("detailVisible");
if ($detailVisible == '1') {
$detailVisible = '1';
} else {
$detailVisible = '0';
}
$destinationPath_TextImage = 'asserts/images/FeatureText';
$destinationPath_BannerImage = 'asserts/images/SecondPage';
$_countFiles = count(Input::file("fileTextImage"));
$_number = 1;
if (Input::hasfile('fileTextImage')) {
foreach (Input::file("fileTextImage") as $file) {
$filename = $file->getClientOriginalName();
if ($_number == $_countFiles) {
$total_files .= $filename;
} else {
$total_files .= $filename . ';';
}
$upload_success = $file->move($destinationPath_TextImage, $filename);
$_number++;
}
}
if ($detailType == 1) {
$filename_Banner = null;
if (Input::hasfile('fileBannerImage')) {
$file_Banner = Input::file("fileBannerImage");
$filename_Banner = $file_Banner->getClientOriginalName();
$upload_success_banner = $file_Banner->move($destinationPath_BannerImage, $filename_Banner);
}
$detailBannerTitle = Input::get("detailBannerTitle");
$detailBannerDescription = Input::get("detailBannerDescription");
if ($filename_Banner == null && $total_files == null) {
$_arData = array('detailName' => $detailName, 'detailTitle' => $detailTitle, 'detailUrl' => $detailUrl, 'detailParent' => $detailParent, 'detailBannerTitle' => $detailBannerTitle, 'detailBannerDescription' => $detailBannerDescription, 'detailContent' => $detailContent, 'detailVisible' => $detailVisible);
} else {
if ($filename_Banner == null && $total_files != null) {
$_arData = array('detailName' => $detailName, 'detailTitle' => $detailTitle, 'detailUrl' => $detailUrl, 'detailParent' => $detailParent, 'detailBannerTitle' => $detailBannerTitle, 'detailBannerDescription' => $detailBannerDescription, 'detailContent' => $detailContent, 'detailTextImage' => $total_files, 'detailVisible' => $detailVisible);
} else {
if ($filename_Banner != null && $total_files == null) {
$_arData = array('detailName' => $detailName, 'detailTitle' => $detailTitle, 'detailUrl' => $detailUrl, 'detailParent' => $detailParent, 'detailBannerTitle' => $detailBannerTitle, 'detailBannerDescription' => $detailBannerDescription, 'detailContent' => $detailContent, 'detailBannerImage' => $filename_Banner, 'detailVisible' => $detailVisible);
} else {
if ($filename_Banner != null && $total_files != null) {
$_arData = array('detailName' => $detailName, 'detailTitle' => $detailTitle, 'detailUrl' => $detailUrl, 'detailParent' => $detailParent, 'detailBannerTitle' => $detailBannerTitle, 'detailBannerDescription' => $detailBannerDescription, 'detailContent' => $detailContent, 'detailTextImage' => $total_files, 'detailBannerImage' => $filename_Banner, 'detailVisible' => $detailVisible);
}
}
}
}
} else {
if ($total_files == null) {
$_arData = array('detailName' => $detailName, 'detailTitle' => $detailTitle, 'detailUrl' => $detailUrl, 'detailContent' => $detailContent, 'detailParent' => $detailParent, 'detailVisible' => $detailVisible);
} else {
$_arData = array('detailName' => $detailName, 'detailTitle' => $detailTitle, 'detailUrl' => $detailUrl, 'detailContent' => $detailContent, 'detailParent' => $detailParent, 'detailTextImage' => $total_files, 'detailVisible' => $detailVisible);
}
}
$_page_update = Pages::where('detailId', Input::get("detailId"))->update($_arData);
} catch (Exception $_ex) {
Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$');
}
Session::flash('success', '$$$ --- Update Page Successfully --- $$$');
return Redirect::to('qlm-admin/pages/' . Input::get("detailId"));
}
示例13: delete_image_1
public function delete_image_1()
{
try {
$sequence = 0;
$id = Input::get('id');
$_arrayImages = explode(";", Input::get('images'));
$images = $_arrayImages;
$image = Input::get('image');
$new_image = '';
foreach ($images as $_image) {
if ($_image != $image) {
if ($sequence == count($images) - 1) {
$new_image .= $_image;
} else {
$new_image .= $_image . ';';
}
}
$sequence++;
}
if (ends_with($new_image, ';')) {
$_arrayImages = '';
$_arrayImages = explode(";", $new_image);
$new_image = '';
$sequence = 0;
foreach ($_arrayImages as $_image) {
$sequence++;
if ($sequence < count($images) - 1) {
$new_image .= $_image . ';';
} else {
if ($sequence == count($images) - 1) {
$new_image .= $_image;
}
}
}
}
$isUpdate = Pages::where('detailId', $id)->update(array('detailTextImage' => $new_image));
Log::error('$page.' . $isUpdate);
return Response::json(['status' => 'success', 'msg' => 'Đăng nhập thành công!']);
} catch (Exception $_ex) {
Log::error('Error: ' . $_ex);
return Response::json(['status' => 'error', 'msg' => 'Đăng nhập thành công!']);
}
}
示例14: siteMap_xml
public function siteMap_xml()
{
try {
$page = Pages::where("_name", "=", "sitemap")->get()->first();
$pages = Pages::where('_dependsOn', "=", NULL)->where("_public", "=", "1")->orderBy('_priority', 'DESC')->get();
$news = News::orderBy('_date', 'DESC')->get();
} catch (Exception $e) {
App::abort(500);
}
$header = '<?xml version="1.0" encoding="UTF-8"?>';
// Renvoi de la vue avec les news et l'en-tête :
$page = $this->layout->content = View::make('pages.sitemap.sitemap_xml', array("news" => $news, "pages" => $pages, "header" => $header));
return Response::make($page, '200')->header('Content-Type', 'text/xml');
}
示例15: bottomMenu
public function bottomMenu()
{
$pages = Pages::where('published_at', '<', date('Y-m-d H:i:s'))->where('is_published', 1)->with('parent')->get(['id', 'published_at', 'parent_id', 'is_published', 'alias', 'menu_title']);
return (string) View::make('widgets.menu.bottom', compact('pages'))->render();
}