當前位置: 首頁>>代碼示例>>PHP>>正文


PHP View::with方法代碼示例

本文整理匯總了PHP中View::with方法的典型用法代碼示例。如果您正苦於以下問題:PHP View::with方法的具體用法?PHP View::with怎麽用?PHP View::with使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在View的用法示例。


在下文中一共展示了View::with方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: compose

 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose($view)
 {
     if (!isset($view['categories'])) {
         $categories = ProductCategory::whereNull('category_id')->with('subitems')->get();
         $view->with('categories', $categories);
         $view->with('parent', null);
     }
 }
開發者ID:teewebapp,項目名稱:product,代碼行數:14,代碼來源:CategoriesComposer.php

示例2: post

 public function post()
 {
     if (IS_POST) {
         $data = json_decode(Request::post('keyword'), TRUE);
         $data['rank'] = $data['istop'] == 1 ? 255 : min(255, intval($data['rank']));
         $data['module'] = v('module.name');
         $data['keywords'] = $data['keyword'];
         $rid = service('WeChat')->rule($data);
         //調用模塊的執行方法
         $module = new $this->moduleClass();
         //字段驗證
         if ($msg = $module->fieldsValidate($rid)) {
             message($msg, 'back', 'error');
         }
         //使模塊保存回複內容
         $module->fieldsSubmit($rid);
         message('規則保存成功', u('post', ['rid' => $rid, 'm' => v('module.name')]));
     }
     //獲取關鍵詞回複
     if ($rid = Request::get('rid')) {
         $data = Db::table('rule')->find($rid);
         if (empty($data)) {
             message('回複規則不存在', 'back', 'error');
         }
         $data['keyword'] = Db::table('rule_keyword')->orderBy('id', 'asc')->where('rid', $rid)->get();
         View::with('rule', $data);
     }
     $module = new $this->moduleClass();
     $moduleForm = $module->fieldsDisplay($rid);
     return view()->with('moduleForm', $moduleForm);
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:31,代碼來源:Reply.php

示例3: weixin

 /**
  * 支付
  *
  * @param $param
  */
 public function weixin($param)
 {
     if (!v('module.name') || !Session::get('member.uid') || empty($param['goods_name']) || empty($param['fee']) || empty($param['body']) || empty($param['tid'])) {
         message('支付參數錯誤,請重新提交', 'back', 'error');
     }
     if ($pay = Db::table('pay')->where('tid', $param['tid'])->first()) {
         if ($pay['status'] == 1) {
             message('定單已經支付完成', $param['back_url'], 'success');
         }
     }
     $data['siteid'] = SITEID;
     $data['uid'] = Session::get('member.uid');
     $data['tid'] = $param['tid'];
     $data['fee'] = $param['fee'];
     $data['goods_name'] = $param['goods_name'];
     $data['attach'] = isset($param['attach']) ? $param['attach'] : '';
     //附加數據
     $data['module'] = v('module.name');
     $data['body'] = $param['body'];
     $data['attach'] = $param['attach'];
     $data['status'] = 0;
     $data['is_usecard'] = isset($param['is_usecard']) ? $param['is_usecard'] : 0;
     $data['card_type'] = isset($param['card_type']) ? $param['card_type'] : '';
     $data['card_id'] = isset($param['is_usecard']) ? $param['card_id'] : 0;
     $data['card_fee'] = isset($param['card_fee']) ? $param['card_fee'] : 0;
     if (empty($pay)) {
         Db::table('pay')->insertGetId($data);
     }
     Session::set('pay', ['tid' => $data['tid'], 'module' => v('module.name'), 'siteid=' => SITEID]);
     View::with('data', $data);
     View::make('server/build/template/pay.html');
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:37,代碼來源:Pay.php

示例4: doWebLists

 public function doWebLists()
 {
     $Model = new CreditsRecord();
     //會員信息
     $user = Db::table('member')->where('uid', Session::get('member.uid'))->first();
     if ($timerange = q('get.timerange')) {
         //有篩選時間的
         $timerange = explode('至', $timerange);
         $total = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->where('createtime', '>=', strtotime($timerange[0]))->where('createtime', '<=', strtotime($timerange[1]))->count();
         $page = Page::row(8)->make($total);
         $data = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->where('createtime', '>=', strtotime($timerange[0]))->where('createtime', '<=', strtotime($timerange[1]))->limit(Page::limit())->get();
     } else {
         $total = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->count();
         $page = Page::row(8)->make($total);
         $data = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->limit(Page::limit())->get();
     }
     //收入
     $income = $Model->where('num', '>', 0)->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->sum('num');
     //支出
     $expend = $Model->where('num', '<', 0)->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->sum('num');
     View::with(['income' => $income, 'expend' => $expend]);
     View::with('page', $page);
     View::with('user', $user);
     View::with('data', $data);
     View::make($this->ucenter_template . '/credit_lists.html');
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:26,代碼來源:credit.php

示例5: run

 public function run()
 {
     //分配表單驗證數據
     View::with('errors', Session::flash('errors'));
     //清除閃存
     Session::flash('[del]');
 }
開發者ID:houdunwang,項目名稱:hdphp,代碼行數:7,代碼來源:App.php

示例6: index

 public function index()
 {
     //商品分類
     $cate = new \Home\Model\Cate();
     $cateData = $cate->getChan();
     // p($cateData);
     View::with('cateData', $cateData);
     //創建商品對象
     $goods = new \Home\Model\Goods();
     //最新發布商品
     $new = $goods->getNew();
     View::with('new', $new);
     //重組分類列表,並去取出8件商品
     $cateTree = $cateData;
     foreach ($cateData as $k => $v) {
         $a = array();
         //取該分組下的三級分類
         foreach ($v['_data'] as $m => $n) {
             $a = array_merge($a, array_keys($n['_data']));
         }
         unset($cateTree[$k]['_data']);
         $cateTree[$k]['three'] = $a;
         if ($a) {
             $level_goods = $goods->whereIn('cate_id', $a)->limit(8)->get();
             $cateTree[$k]['level_goods'] = $level_goods;
         }
     }
     // p($cateTree);
     View::with('cateTree', $cateTree);
     View::make($this->tpl . 'index.html');
 }
開發者ID:ChenHuaPHP,項目名稱:ZOLshop,代碼行數:31,代碼來源:IndexController.php

示例7: moduleBrowser

 public function moduleBrowser()
 {
     service('user')->loginAuth();
     View::with('modules', v('site.modules'));
     View::with('useModules', explode(',', q('get.mid', '', [])));
     return view();
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:7,代碼來源:Component.php

示例8: compose

 /**
  * Attach required data to Dashboard Menus view.
  * 
  * @param  View $view
  * @return void
  */
 public function compose($view)
 {
     $routes = $this->getAllRoutes();
     $partials = $this->getDropdownPartials();
     $pages = $this->getPages();
     $view->with('routes', $routes)->with('partials', $partials)->with('pages', $pages);
 }
開發者ID:onlystar1991,項目名稱:mtdb,代碼行數:13,代碼來源:DashMenusComposer.php

示例9: compose

 public function compose(View $view)
 {
     $tags = Tag::orderBy('id', 'DESC')->get();
     $categories = Category::orderBy('id', 'DESC')->simplepaginate(7);
     $images = Image::orderBy('id', 'DESC')->paginate(4);
     $view->with('tags', $tags)->with('categories', $categories)->with('images', $images);
 }
開發者ID:EstevenJaviier,項目名稱:Semillero-IN,代碼行數:7,代碼來源:AsideComposer.php

示例10: doSiteSitePost

 public function doSiteSitePost()
 {
     if (IS_POST) {
         $data = json_decode($_POST['data'], TRUE);
         $data['site_info'] = $_POST['data'];
         $insertId = $this->web->save($data);
         $web['id'] = $this->webid ?: $insertId;
         //添加回複規則
         $rule = [];
         $rule['rid'] = Db::table('reply_cover')->where('web_id', $web['id'])->pluck('rid');
         $rule['module'] = 'cover';
         $rule['name'] = '微站:' . $data['title'];
         $rule['keywords'] = [['content' => $data['keyword']]];
         $rid = service('WeChat')->rule($rule);
         //添加封麵回複
         $replyCover = new ReplyCover();
         $replyCover->where('rid', $rid)->delete();
         $data['web_id'] = $web['id'];
         $data['rid'] = $rid;
         $data['module'] = 'article';
         $data['url'] = '?a=entry/home&m=article&t=web&siteid=' . SITEID . '&webid=' . $web['id'];
         $replyCover->save($data);
         message('保存站點數據成功', site_url('site'), 'success');
     }
     if ($this->webid) {
         //編輯數據時
         $web = $this->web->find($this->webid);
         $field = json_decode($web['site_info'], TRUE);
         $field['id'] = $this->webid;
     }
     View::with('field', isset($field) ? json_encode($field, JSON_UNESCAPED_UNICODE) : '');
     return View::make($this->template . '/manage/sitePost.php');
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:33,代碼來源:manage.php

示例11: index

 public function index()
 {
     $id = Q('pid');
     $node = new \Admin\Model\Node();
     $node = $node->getchannletree();
     $access = (array) $this->db->getAccessNode($id);
     View::with('node', $node)->with('access', $access)->make();
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:8,代碼來源:AccessController.php

示例12: doWebEmploy

 public function doWebEmploy()
 {
     $tid = q('get.tid', 0, 'intval');
     //會員卡卷記錄
     $ticket = Db::table('ticket')->where('tid', $tid)->first();
     View::with('ticket', $ticket);
     View::make($this->ucenter_template . '/ticket_employ.html');
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:8,代碼來源:ticket.php

示例13: pay

 public function pay()
 {
     //分配模板文件配置
     $tplData['title'] = "在線支付";
     $tplData['css'] = "cart|pay";
     View::with('tplData', $tplData);
     View::make($this->tpl . 'pay.html');
 }
開發者ID:ChenHuaPHP,項目名稱:ZOLshop,代碼行數:8,代碼來源:OrderController.php

示例14: run

 public function run()
 {
     //分配表單驗證數據
     $errors = \Session::flash('validate');
     \View::with('errors', $errors);
     //清除閃存
     \Session::flash('[del]');
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:8,代碼來源:AppStart.php

示例15: doWebShow

 public function doWebShow()
 {
     $id = q('get.id', 0, 'intval');
     $article = Db::table('reply_news')->where('id', $id)->first();
     $tpl = __TEMPLATE__ . '/article.html';
     View::with('hdcms', $article);
     return view($tpl);
 }
開發者ID:houdunwang,項目名稱:hdcms,代碼行數:8,代碼來源:site.php


注:本文中的View::with方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。