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


PHP Category::lists方法代码示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $cats = \App\Models\Category::lists('id');
     foreach (\App\Models\User::withTrashed()->get() as $user) {
         $user->categories = $cats;
         $user->save();
     }
 }
开发者ID:sirx,项目名称:w0bm.com,代码行数:13,代码来源:FilterSeeder.php

示例2: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $tags = Tag::lists("name", "id");
     $article = Article::with("tags")->find($id);
     $categories = Category::lists("name", "id");
     //        dd($article->tags->lists("id"));
     return view("dashboard.articles.edit", compact("article", "categories", "tags"));
 }
开发者ID:bassx1,项目名称:lessons,代码行数:14,代码来源:ArticlesController.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     $cates = Category::lists('id')->toArray();
     for ($i = 1; $i <= 50; $i++) {
         Post::create(['title' => $faker->sentence(), 'summary' => $faker->paragraph(), 'category_id' => $faker->randomElement($cates), 'body' => $faker->text(10000), 'origin' => '', 'comment_count' => rand(0, 10), 'view_count' => rand(0, 200), 'favorite_count' => rand(0, 100), 'published' => rand(0, 1), 'slug' => 'post-' . $i]);
     }
 }
开发者ID:forehalo,项目名称:materialize-blog,代码行数:8,代码来源:DatabaseSeeder.php

示例4: adverts_update

 public function adverts_update($id)
 {
     $advert = Advertisement::find($id);
     if (!$advert) {
         abort(404);
     }
     $categories_select = Category::lists('uk_title', 'id');
     return view('admin.advert_update')->with('advert', $advert)->with('categories_select', $categories_select);
 }
开发者ID:andriy-sa,项目名称:laravel,代码行数:9,代码来源:AdminController.php

示例5: edit

 public function edit($id)
 {
     $categories = Category::lists('title', 'id');
     $product = Product::find($id);
     $selected = [];
     foreach ($product->categories()->get() as $item) {
         array_push($selected, $item->id);
     }
     return view('admin.products.edit')->with('categories', $categories)->with('selected', $selected)->with('product', $product);
 }
开发者ID:ninjamonz,项目名称:laravel_catalog_example,代码行数:10,代码来源:ProductsController.php

示例6: edit

 public function edit($id)
 {
     $book = Book::find($id);
     //if (auth()->user()->can('manageBook', $book)) {
     //if (Gate::denies('manageBook', $book)) {
     if (Gate::denies('manageBook', $book)) {
         abort(403, 'voce não é o dono desse livro');
     }
     $categories = Category::lists('name', 'id');
     return view('admin.books.edit', compact('book', 'categories'));
 }
开发者ID:phelipperibeiro,项目名称:book_store_laravel,代码行数:11,代码来源:BooksController.php

示例7: sell

 public function sell()
 {
     $categories = Category::lists('name', 'id');
     if (Request::isMethod('post')) {
         $rules = ['name' => 'required', 'description' => 'required', 'category' => 'required', 'file1' => 'required|mimes:jpeg,bmp,png', 'file2' => 'required|mimes:jpeg,bmp,png'];
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             $messages = $validator->messages();
             return Redirect::to('piac/eladok')->withErrors($messages)->withInput();
         } else {
             $adv = new Advertisement();
             $adv->name = Input::get('name');
             $adv->description = Input::get('description');
             $adv->category_id = Input::get('category');
             $adv->visible_from = Input::get('visible_from');
             $adv->visible_until = Input::get('visible_until');
             $adv->user_id = Auth::id();
             $adv->seo_url = Helper::lake_directory(Input::get('name'));
             $adv->save();
             if (Input::hasFile('file1') && Input::hasFile('file2')) {
                 $files = [];
                 $files[] = Input::file('file1');
                 $files[] = Input::file('file2');
                 $files[] = Input::file('file3');
                 $files[] = Input::file('file4');
                 $files[] = Input::file('file5');
                 foreach ($files as $key => $file) {
                     $directory = 'USER_' . Auth::id() . '/' . $adv->id;
                     $tmpFilePath = $_SERVER['DOCUMENT_ROOT'] . '/images/advertisements/' . $directory . '/';
                     if ($file) {
                         $tmpFileName = time() . '-' . $file->getClientOriginalName();
                         $file->move($tmpFilePath, $tmpFileName);
                         $advImg = new AdvertisementImage();
                         $advImg->advertisement_id = $adv->id;
                         $advImg->url = $directory . '/' . $tmpFileName;
                         $advImg->save();
                     }
                 }
             }
             Session::flash('message', 'Köszönjük!.Egyik adminisztrátorunk engedélyezni fogja hírdetésedet a következő 30 percben.');
             return Redirect::to('/');
         }
     }
     return view('market.sell', ['categories' => $categories]);
 }
开发者ID:Thor89,项目名称:horgaszkalandok,代码行数:45,代码来源:MarketController.php

示例8: update

 public function update($locale, $id)
 {
     $advertisement = Advertisement::where('published', 1)->where('id', $id)->first();
     if (!$advertisement || Auth::user()->id != $advertisement->user_id) {
         abort(404);
     }
     $categoryModel = new Category();
     $categories = $categoryModel->get_order_count();
     $categories_select = Category::lists(Config::get('app.locale') . '_title', 'id');
     $validtor = JsValidator::make($this->rules);
     $title = trans('message.update') . ': ' . $advertisement->title;
     return view('site.advertisements.update')->with('categories', $categories)->with('categories_select', $categories_select)->with('validator', $validtor)->with('title', $title)->with('advertisement', $advertisement);
 }
开发者ID:andriy-sa,项目名称:laravel,代码行数:13,代码来源:AdvertisementController.php

示例9: createItem

 /**
  *
  * @return Item
  */
 public function createItem($parent = NULL)
 {
     $categoryIds = Category::lists('id')->all();
     $item = new Item(['title' => $this->faker->sentence, 'category_id' => $this->faker->randomElement($categoryIds), 'priority' => $this->faker->numberBetween(1, 5)]);
     //        if ($item->priority === 1) {
     //            $urgent = $this->faker->boolean(5);
     //            if ($urgent) {
     //                $item->urgency = 1;
     //            }
     //        }
     $item->user()->associate(User::first());
     if ($this->faker->boolean(50)) {
         $item->body = 'item body';
     }
     if (!is_null($parent)) {
         $item->parent()->associate($parent);
     }
     $item->save();
     return $item;
 }
开发者ID:JennySwift,项目名称:lists,代码行数:24,代码来源:ItemSeeder.php

示例10: composeProductsForm

 public function composeProductsForm()
 {
     view()->composer('site.products.fields', function ($view) {
         $view->with('categories', \App\Models\Category::lists('name', 'id'))->with('tags', \App\Models\Tag::lists('name', 'id'))->with('files', \App\Fileentry::lists('original_filename', 'id'));
     });
 }
开发者ID:jclyons52,项目名称:mycourse-rocks,代码行数:6,代码来源:ViewComposerServiceProvider.php

示例11: projectedit

 public function projectedit(ProjectRepository $project_repo)
 {
     $categories = Category::lists('name', 'id');
     $genres = Genre::lists('name', 'id');
     $g_countries = Country::lists('countryName', 'countryID');
     $step_value = Session::get('editfstep');
     $edit_id = Session::has('editfs_id') ? Session::get('editfs_id') : '';
     $statArr = array('' => " -- Select -- ");
     $countries = array_merge($statArr, $g_countries);
     if (isset($edit_id)) {
         $projectdet = Project::where('id', $edit_id)->first();
     } else {
         $projectdet = array();
     }
     $gountryId = $projectdet['country_id'];
     $citylist = $this->project_repo->getcitylist($gountryId);
     $datan = array();
     foreach ($citylist as $cityval) {
         $id = $cityval['cityID'];
         $name = $cityval['cityName'];
         $datan[$id] = $name;
     }
     $rewardlist = $this->project_repo->getrewarddata($edit_id);
     if ($step_value == 1) {
         return view('project.startaproject-edit', ['last_insert_id' => $edit_id, 'categories' => $categories, 'genres' => $genres, 'projectdet' => $projectdet, '_menus' => $this->menuItems, 'login_url' => $this->login_url]);
     } elseif ($step_value == 2) {
         return view('project.startaproject-step2-edit', ['last_insert_id' => $edit_id, 'countries' => $countries, 'projectdet' => $projectdet, 'citylist' => $datan, '_menus' => $this->menuItems, 'login_url' => $this->login_url]);
     } elseif ($step_value == 3) {
         $prewordstat = $this->project_repo->projectrewordd($edit_id);
         if ($prewordstat > 0) {
             $rview = 'project.startaproject-step3-edit';
         } else {
             $rview = 'project.startaproject-step3';
         }
         return view($rview, ['rewardlist' => $rewardlist, 'last_insert_id' => $edit_id, 'projectdet' => $projectdet, '_menus' => $this->menuItems, 'login_url' => $this->login_url]);
     } elseif ($step_value == 4) {
         return view('project.project.create-step4', ['last_insert_id' => $edit_id, '_menus' => $this->menuItems, 'login_url' => $this->login_url]);
     } elseif ($step_value == 5) {
         return view('project.startaproject-confirmation', ['last_insert_id' => $edit_id, 'projectdet' => $projectdet, '_menus' => $this->menuItems, 'login_url' => $this->login_url]);
     } else {
         return view('project.project.editproject', ['last_insert_id' => $edit_id, '_menus' => $this->menuItems, 'login_url' => $this->login_url]);
     }
 }
开发者ID:udayc,项目名称:travel,代码行数:43,代码来源:ProjectController.php

示例12: __construct

 /**
  * Create a new profile composer.
  *
  * @param  UserRepository  $categories
  * @return void
  */
 public function __construct()
 {
     $this->categories = Category::lists('name', 'id')->toArray();
 }
开发者ID:RsanabriaZ,项目名称:web-catalog,代码行数:10,代码来源:ProductForm.php

示例13: listCategories

 /**
  * get business category list.
  *
  * TODO: SHOULD BE USED WITH VIEW COMPOSER
  *
  * @return array list of categories for combo
  */
 protected function listCategories()
 {
     return Category::lists('slug', 'id')->transform(function ($item) {
         return trans('app.business.category.' . $item);
     });
 }
开发者ID:zeke8402,项目名称:timegrid,代码行数:13,代码来源:BusinessController.php

示例14: edit

 /**
  * Show the form for editing the specified employees.
  *
  * @    param  int $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $employees = $this->employeesRepository->find($id);
     $TipoDoc = \App\Models\comboType::find(1)->Options->lists('description', 'id');
     $Sexo = \App\Models\comboType::find(3)->Options->lists('description', 'id');
     $EstadoCivil = \App\Models\comboType::find(4)->Options->lists('description', 'id');
     $TipoContrato = \App\Models\comboType::find(5)->Options->lists('description', 'id');
     $Ubicacion = \App\Models\comboType::find(6)->Options->lists('description', 'id');
     $Localidades = \App\Models\comboType::join('comboOptions', 'comboTypes.id', '=', 'comboOptions.type_id')->where('comboTypes.type', 'Localidades')->lists('comboOptions.description', 'comboOptions.id')->prepend('', '');
     $turno = \App\Models\comboType::join('comboOptions', 'comboTypes.id', '=', 'comboOptions.type_id')->where('comboTypes.type', 'Turno')->lists('comboOptions.description', 'comboOptions.id')->prepend('', '');
     $ObraSocial = \App\Models\obraSocial::selectRaw('CONCAT(codigo, "-", nombre) as nombre, id')->lists('nombre', 'id')->prepend('', '');
     $Category = \App\Models\Category::lists('category', 'id')->prepend('', '');
     $Specialty = \App\Models\Specialty::where('category', '=', $employees->categoria)->get()->lists('specialty', 'id')->prepend('', '');
     $conceptos_revista = \App\Models\concepto_revista::where('id', '!=', $employees->estado)->lists('descripcion', 'id')->prepend('', '');
     $estado_revista = \App\Models\concepto_revista::find($employees->estado);
     $situacion_revista = \App\Models\EstadosRevista::with('Situacion')->DelLegajoVigente($id)->first();
     $conyugue = \App\Models\Familiar::ConyugueDe($id)->first();
     $hijos = \App\Models\Familiar::HijosDe($id)->get();
     //$estados_revista  = \App\Models\estado_revista::lists('descripcion','id');
     //$categoria  = \App\Models\Categorias::lists('categoria','id');
     //$especialidad  = \App\Models\Especialidades::lists('especialidad','id');
     if (empty($employees)) {
         Flash::error('employees not found');
         return redirect(route('employees.index'));
     }
     return view('employees.edit', compact('employees', 'TipoDoc', 'turno', 'Sexo', 'EstadoCivil', 'Ubicacion', 'TipoContrato', 'ObraSocial', 'Category', 'Specialty', 'conceptos_revista', 'estado_revista', 'situacion_revista', 'conyugue', 'hijos', 'Localidades'));
     //->with('estados_revista', $estados_revista)
     //->with('categoria', $categoria)
     //->with('especialidad', $especialidad)
 }
开发者ID:gabrieljaime,项目名称:Payroll-Laravel5,代码行数:37,代码来源:EmployeesController.php

示例15: __construct

 public function __construct()
 {
     $this->categories = Category::lists('title', 'id');
     $this->cities = Cities::get()->toArray();
     $this->ad_types = AdType::lists('name', 'id');
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:6,代码来源:SelectComposer.php


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