当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::all方法代码示例

本文整理汇总了PHP中Category::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::all方法的具体用法?PHP Category::all怎么用?PHP Category::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Category的用法示例。


在下文中一共展示了Category::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $product = Product::find($id);
     $categories = array('') + Category::all()->lists('name', 'id');
     return View::make('products.create', array('product' => $product, 'categories' => $categories));
 }
开发者ID:alexixim,项目名称:blood-bank,代码行数:13,代码来源:ProductController.php

示例2: index

 public static function index()
 {
     return function ($request, $response) {
         $models = Category::all();
         $response->json($models->as_array());
     };
 }
开发者ID:samdubey,项目名称:ads2,代码行数:7,代码来源:categoryctrl.php

示例3: getEdit

 public function getEdit($id)
 {
     // Find the module using the user id
     $module = Module::find($id);
     // No such id
     if ($module == null) {
         return \View::make('redminportal::pages/404');
     }
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     $tagString = "";
     foreach ($module->tags as $tag) {
         if (!empty($tagString)) {
             $tagString .= ",";
         }
         $tagString .= $tag->name;
     }
     if (empty($module->options)) {
         $module_cn = (object) array('name' => $module->name, 'short_description' => $module->short_description, 'long_description' => $module->long_description);
     } else {
         $module_cn = json_decode($module->options);
     }
     $pricelists = array();
     foreach (Membership::orderBy('rank')->get() as $membership) {
         $pricelist = Pricelist::where('module_id', $module->id)->where('membership_id', $membership->id)->first();
         if ($pricelist == null) {
             $pricelists[] = array('id' => $membership->id, 'name' => $membership->name, 'price' => '');
         } else {
             $pricelists[] = array('id' => $membership->id, 'name' => $membership->name, 'price' => $pricelist->price);
         }
     }
     return \View::make('redminportal::modules/edit')->with('module', $module)->with('module_cn', $module_cn)->with('imageUrl', 'assets/img/modules/')->with('categories', $categories)->with('tagString', $tagString)->with('pricelists', $pricelists);
 }
开发者ID:tusharvikky,项目名称:redminportal,代码行数:35,代码来源:ModuleController.php

示例4: search

 public function search()
 {
     $param['pageNo'] = 1;
     $param['store_name'] = Input::has('store') ? Input::get('store') : '';
     $param['company_name'] = Input::has('company') ? Input::get('company') : '';
     $param['category_id'] = Input::has('category') ? Input::get('category') : '';
     $param['city_id'] = Input::has('city') ? Input::get('city') : '';
     $param['waiting_time_min'] = Input::has('min') ? Input::get('min') : WAITING_TIME_MIN;
     $param['waiting_time_max'] = Input::has('max') ? Input::get('max') : WAITING_TIME_MAX;
     $param['is_all'] = Input::has('is_all') ? true : !Input::has('min');
     $userId = Session::has('user_id') ? Session::get('user_id') : 0;
     $prefix = DB::getTablePrefix();
     $result = DB::table('store')->join('company', 'store.company_id', '=', 'company.id')->leftJoin(DB::raw('(SELECT * FROM ' . $prefix . 'queue WHERE user_id = ' . $userId . ' AND DATE(created_at) = DATE(NOW()) GROUP BY store_id) AS ' . $prefix . 'queues'), 'store.id', '=', 'queues.store_id')->join('status', 'store.id', '=', 'status.store_id')->leftJoin(DB::raw('(SELECT count(*) as cnt, store_id FROM ' . $prefix . 'agent WHERE is_active = 1 GROUP BY store_id) AS ' . $prefix . 'agt'), 'agt.store_id', '=', 'store.id')->join('company_setting', 'company_setting.company_id', '=', 'company.id')->join('category', 'category.id', '=', 'company.category_id')->join('city', 'city.id', '=', 'company.city_id')->select('store.id', 'store.name as store_name', 'store.address as address', 'company.name as company_name', 'company_setting.waiting_time', 'status.current_queue_no', 'status.last_queue_no', 'agt.cnt', 'queues.queue_no');
     if ($param['store_name'] != '') {
         $result = $result->where('store.name', 'like', '%' . $param['store_name'] . '%');
     }
     if ($param['company_name'] != '') {
         $result = $result->where('company.name', 'like', '%' . $param['company_name'] . '%');
     }
     if ($param['category_id'] != '') {
         $result = $result->where('category.id', '=', $param['category_id']);
     }
     if ($param['city_id'] != '') {
         $result = $result->where('city.id', '=', $param['city_id']);
     }
     if (!$param['is_all']) {
         $result = $result->whereRaw($prefix . 'agt.cnt > 0')->whereRaw('((' . $prefix . 'status.last_queue_no - ' . $prefix . 'status.current_queue_no' . ') * ' . $prefix . 'company_setting.waiting_time / 60) / (' . $prefix . 'agt.cnt)' . ' BETWEEN ' . $param['waiting_time_min'] . ' AND ' . $param['waiting_time_max']);
     }
     $stores = $result->paginate(PAGINATION_SIZE);
     $param['stores'] = $stores;
     $param['categories'] = CategoryModel::all();
     $param['cities'] = CityModel::all();
     return View::make('user.store.search')->with($param);
 }
开发者ID:victory21th,项目名称:QM-Laravel,代码行数:34,代码来源:StoreController.php

示例5: getEdit

 public function getEdit($id)
 {
     // Find the media using the user id
     $media = Media::find($id);
     // No such id
     if ($media == null) {
         return \View::make('redminportal::pages/404');
     }
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     $tagString = "";
     foreach ($media->tags as $tag) {
         if (!empty($tagString)) {
             $tagString .= ",";
         }
         $tagString .= $tag->name;
     }
     if (empty($media->options)) {
         $media_cn = (object) array('name' => $media->name, 'short_description' => $media->short_description, 'long_description' => $media->long_description);
     } else {
         $media_cn = json_decode($media->options);
     }
     return \View::make('redminportal::medias/edit')->with('media', $media)->with('media_cn', $media_cn)->with('imageUrl', 'assets/img/medias/')->with('categories', $categories)->with('tagString', $tagString);
 }
开发者ID:tusharvikky,项目名称:redminportal,代码行数:26,代码来源:MediaController.php

示例6: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id = NULL)
 {
     $currUser = Auth::user();
     $oCategories = Category::all();
     $oCity = Cities::all();
     $oVacancy = null;
     if ($id > 0) {
         $oVacancy = Vacancy::find($id);
     }
     foreach ($oCategories as $item) {
         $aCategories[$item->id] = $item->name;
     }
     if (Auth::user()->is_admin == 0) {
         $aCompanies = Companies::where('user_id', '=', $currUser->id)->get();
     } else {
         $aCompanies = Companies::all();
     }
     foreach ($aCompanies as $item) {
         $aCompany[$item->id] = $item->name;
     }
     $oQuery = Regions::join('country', 'country.id', '=', 'country_id')->select('regions.id as id', 'regions.name', 'country.name as country_name', 'country.id as country_id');
     if ($oRegions = $oQuery->get()) {
     }
     foreach ($oRegions as $item) {
         $aRegions[$item->country_name] = array();
         $aCity = Cities::where('region_id', '=', $item->id)->get();
         foreach ($aCity as $city) {
             $aRegions[$item->name][$city->id] = $city->name;
         }
     }
     if ($currUser->is_admin == 0 && (empty($oVacancy) === false && $oVacancy->user_id != $currUser->id)) {
         return Redirect::route('vacancy-list', array('user_id' => $currUser->id));
     }
     return View::make('/vacancy/edit', array('currUser' => $currUser, 'aCategories' => $aCategories, 'aCompany' => $aCompany, 'aRegions' => $aRegions, 'oVacancy' => $oVacancy, 'id' => $id));
 }
开发者ID:sergey-donchenko,项目名称:hr-agency,代码行数:41,代码来源:VacancyController.php

示例7: index

 /**
  * Display a listing of the resource.
  * GET /categories
  *
  * @return Response
  */
 public function index()
 {
     //
     $category = Category::all();
     //$category = Category::where('user_id', Auth::user()->id)->get();
     return Response::json(array('error' => false, 'categories' => $category->toArray()), 200);
 }
开发者ID:BQumobile,项目名称:api,代码行数:13,代码来源:CategoriesController.php

示例8: getIndex

 public function getIndex()
 {
     if (Auth::guest() || Auth::user()->isAdmin == 0) {
         return Redirect::secure('/');
     }
     // layouts variables
     $this->layout->title = 'Админ панел | Нещо Шантаво';
     $this->layout->canonical = 'https://neshto.shantavo.com/admin/';
     $this->layout->robots = 'noindex,nofollow,noodp,noydir';
     $users = count(User::all());
     $admins = count(User::where('isAdmin', ">", 0)->get());
     $categories = count(Category::all());
     $albums = count(Album::all());
     $votes = count(DB::table('votes')->get());
     $pictures = count(Picture::all());
     $pictureSize = 0;
     foreach (Picture::all() as $p) {
         $pictureSize += $p->size;
     }
     // get disqus stats
     include app_path() . '/config/_disqus.php';
     $disqus = new DisqusAPI(getDisqusKey());
     $disqus->setSecure(false);
     $comments = $disqus->posts->list(array('forum' => 'shantavo'));
     // nesting the view into the layout
     $this->layout->nest('content', 'admin.index', array('users' => $users, 'admins' => $admins, 'votes' => $votes, 'categories' => $categories, 'albums' => $albums, 'pictures' => $pictures, 'pictureSize' => $pictureSize, 'comments' => $comments));
 }
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:27,代码来源:AdminController.php

示例9: show

 public function show($id)
 {
     try {
         $iteration = Iterations::findOrFail($id);
         $iterations = Iterations::where('projectid', '=', $iteration->projectid)->get();
         $project = Project::findOrFail($iteration->projectid);
         $issues = Issue::where('iterationid', '=', $id)->get();
         //$issues = $iteration->issues;
         $countIssues = sizeof($issues);
         $categories = Category::all();
         $idCategory = 0;
         $totalPoints = $issues->sum('points');
         $materiales = Material::all();
         $personal = PersonalType::all();
         $team = Teams::where('projectid', '=', $project->id)->get()->first();
         $members = DB::table('memberof')->where('teamid', '=', $team->id)->get();
         $hasmembers = sizeof($members) > 0 ? true : false;
         $users = array();
         foreach ($members as $member) {
             $users[] = User::findOrFail($member->usersid);
             echo $hasmembers;
         }
         $this->layout->content = View::make('layouts.iterations.show')->with('iteration', $iteration)->with('iterations', $iterations)->with('issues', $issues)->with('categories', $categories)->with('idCategory', $idCategory)->with('countIssues', $countIssues)->with('totalPoints', $totalPoints)->with('project', $project)->with('materiales', $materiales)->with('personal', $personal)->with('hasmembers', $hasmembers)->with('members', $members)->with('users', $users)->with('message', '');
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return Redirect::to('/projects/')->with('message', 'Error al crear la iteración');
     }
 }
开发者ID:josimarjimenez,项目名称:architects,代码行数:27,代码来源:IterationsController.php

示例10: upload

 /**
  * Upload un torrent
  * 
  * @access public
  * @return View torrent.upload
  *
  */
 public function upload()
 {
     $user = Auth::user();
     // Post et fichier upload
     if (Request::isMethod('post')) {
         // No torrent file uploaded OR an Error has occurred
         if (Input::hasFile('torrent') == false) {
             Session::put('message', 'You must provide a torrent for the upload');
             return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
         } else {
             if (Input::file('torrent')->getError() != 0 && Input::file('torrent')->getClientOriginalExtension() != 'torrent') {
                 Session::put('message', 'An error has occurred');
                 return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
             }
         }
         // Deplace et decode le torrent temporairement
         TorrentTools::moveAndDecode(Input::file('torrent'));
         // Array from decoded from torrent
         $decodedTorrent = TorrentTools::$decodedTorrent;
         // Tmp filename
         $fileName = TorrentTools::$fileName;
         // Info sur le torrent
         $info = Bencode::bdecode_getinfo(getcwd() . '/files/torrents/' . $fileName, true);
         // Si l'announce est invalide ou si le tracker et privée
         if ($decodedTorrent['announce'] != route('announce', ['passkey' => $user->passkey]) && Config::get('other.freeleech') == true) {
             Session::put('message', 'Your announce URL is invalid');
             return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
         }
         // Find the right category
         $category = Category::find(Input::get('category_id'));
         // Create the torrent (DB)
         $torrent = new Torrent(['name' => Input::get('name'), 'slug' => Str::slug(Input::get('name')), 'description' => Input::get('description'), 'info_hash' => $info['info_hash'], 'file_name' => $fileName, 'num_file' => $info['info']['filecount'], 'announce' => $decodedTorrent['announce'], 'size' => $info['info']['size'], 'nfo' => Input::hasFile('nfo') ? TorrentTools::getNfo(Input::file('nfo')) : '', 'category_id' => $category->id, 'user_id' => $user->id]);
         // Validation
         $v = Validator::make($torrent->toArray(), $torrent->rules);
         if ($v->fails()) {
             if (file_exists(getcwd() . '/files/torrents/' . $fileName)) {
                 unlink(getcwd() . '/files/torrents/' . $fileName);
             }
             Session::put('message', 'An error has occured may bee this file is already online ?');
         } else {
             // Savegarde le torrent
             $torrent->save();
             // Compte et sauvegarde le nombre de torrent dans  cette catégorie
             $category->num_torrent = Torrent::where('category_id', '=', $category->id)->count();
             $category->save();
             // Sauvegarde les fichiers que contient le torrent
             $fileList = TorrentTools::getTorrentFiles($decodedTorrent);
             foreach ($fileList as $file) {
                 $f = new TorrentFile();
                 $f->name = $file['name'];
                 $f->size = $file['size'];
                 $f->torrent_id = $torrent->id;
                 $f->save();
                 unset($f);
             }
             return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with('message', trans('torrent.your_torrent_is_now_seeding'));
         }
     }
     return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
 }
开发者ID:boozaa,项目名称:swatt,代码行数:67,代码来源:TorrentController.php

示例11: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $project = Project::find($id);
     $categories = Category::all()->lists('name', 'id');
     $customers = Customer::all()->lists('name', 'id');
     return View::make('admin.projects.edit')->with(['project' => $project, 'categories' => $categories, 'customers' => $customers]);
 }
开发者ID:TheFormula,项目名称:westmoreland.dev,代码行数:13,代码来源:ProjectsController.php

示例12: campaign

 /**
  * @before _secure
  */
 public function campaign($id)
 {
     $ad = \Ad::first(['_id' => $id, 'org_id' => $this->org->_id]);
     if (!$ad) {
         $this->_404();
     }
     $this->seo(["title" => $ad->title]);
     $view = $this->getActionView();
     if (RM::post("action")) {
         // action value already checked in _postback func
         $this->_postback('add', ['ad' => $ad]);
     }
     if (RM::type() === 'DELETE') {
         $this->_postback('delete');
     }
     $start = RM::get("start", date('Y-m-d', strtotime("-7 day")));
     $end = RM::get("end", date('Y-m-d'));
     $limit = RM::get("limit", 10);
     $page = RM::get("page", 1);
     $query = ['adid' => Db::convertType($id), 'created' => Db::dateQuery($start, $end)];
     $clicks = \Click::all($query, [], 'created', 'desc', $limit, $page);
     $count = \Click::count($query);
     $cf = Utils::getConfig("cf", "cloudflare");
     $view->set("domain", $cf->api->domain)->set("clicks", $clicks)->set("count", $count)->set('advertiser', $this->user);
     $comms = Commission::all(["ad_id = ?" => $id], ['model', 'coverage', 'revenue', 'description']);
     $models = ArrayMethods::arrayKeys($comms, 'model');
     $advertiser = User::first(["id = ?" => $ad->user_id], ['name']);
     $categories = \Category::all(["org_id = ?" => $this->org->_id], ['name', '_id']);
     $this->_postback('show', ['ad' => $ad]);
     $view->set("ad", $ad)->set("comms", $comms)->set("categories", $categories)->set("advertiser", $advertiser)->set('models', $models)->set("start", $start)->set("end", $end);
 }
开发者ID:vNative,项目名称:vnative,代码行数:34,代码来源:advertiser.php

示例13: getNewProduct

 /**
  * Displays the create product form.
  */
 public function getNewProduct()
 {
     // Get all the categories.
     $categories = Category::all();
     // Render the view.
     return View::make('admin.products.new', ['categories' => $categories]);
 }
开发者ID:Fash1,项目名称:Fash1,代码行数:10,代码来源:AdminController.php

示例14: editPost

 public function editPost($id)
 {
     $category = Category::all();
     $post = Post::find($id);
     $cate = explode(',', $post->category);
     $publishers = Publisher::orderBy('name', 'ASC')->get();
     return View::make('contributor.editPost')->with('title', "Posts Management")->with('page', "posts")->with('category', $category)->with('post', $post)->with('cate', $cate)->with('publishers', $publishers);
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:8,代码来源:ContributorController.php

示例15: setupLayout

 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function setupLayout()
 {
     if (!is_null($this->layout)) {
         $categories = Category::all();
         $pages = Page::all();
         $this->layout = View::make($this->layout)->with('styles', $this->styles)->with('scripts', $this->scripts)->with('content_title', '')->with('categories', $categories)->with('pages', $pages)->with('inline_js', $this->inline_js)->with('sidebar', null);
     }
 }
开发者ID:ddcint,项目名称:benefund,代码行数:13,代码来源:BaseController.php


注:本文中的Category::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。