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


PHP Category::lists方法代码示例

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


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

示例1: edit

 /**
  * Show the form for editing the specified resource.
  * GET /articles/{id}/edit
  *
  * @param  string $slug
  * @return Response
  */
 public function edit($slug)
 {
     $articles = Article::where('slug', $slug)->first();
     $category = Category::lists('category', 'id');
     $selected = Category::where('id', $articles->category_id)->first()->id;
     return View::make('article.editpost')->with('articles', $articles)->with('category', $category)->with('selected', $selected);
 }
开发者ID:tprifti,项目名称:Blog,代码行数:14,代码来源:ArticlesController.php

示例2: edit

 public function edit($id)
 {
     if (Request::isMethod('post')) {
         $rules = array('title' => 'required|min:4', 'link' => 'required', 'meta_keywords' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             return Redirect::to("admin/category/{$id}/edit")->withErrors($validator)->withInput(Input::except(''));
         } else {
             $table = Category::find($id);
             $table->title = Input::get('title');
             $table->link = Input::get('link');
             $table->content = Input::get('content');
             $table->parent_id = Input::get('parent_id') ? Input::get('parent_id') : null;
             $table->meta_title = Input::get('meta_title') ? Input::get('meta_title') : $table->title;
             $table->meta_description = Input::get('meta_description') ? Input::get('meta_description') : $table->description;
             $table->meta_keywords = Input::get('meta_keywords');
             $table->active = Input::get('active', 0);
             if ($table->save()) {
                 $name = trans("name.category");
                 return Redirect::to("admin/category")->with('success', trans("message.edit", ['name' => $name]));
             }
             return Redirect::to("admin/category")->with('error', trans('message.error'));
         }
     }
     $self = Category::where('id', '=', $id)->first();
     foreach (Category::lists('title', 'id') as $key => $value) {
         $child = Category::where('id', '=', $key)->first();
         if (!$child->isSelfOrDescendantOf($self)) {
             $categories[$key] = $value;
         }
     }
     $categories = array(0 => 'Нет родительской категории') + $categories;
     return View::make("admin.shop.category.edit", ['item' => Category::find($id), 'categories' => $categories]);
 }
开发者ID:Rotron,项目名称:shop,代码行数:34,代码来源:AdminCategoryController.php

示例3: edit

 public function edit($id)
 {
     $post = Post::find($id);
     $this->authorOrAdminPermissioinRequire($post->user_id);
     $category_selects = Category::lists('name', 'id');
     return View::make('posts.create_edit', compact('category_selects', 'post'));
 }
开发者ID:Kouga-Huang,项目名称:laravel-blog,代码行数:7,代码来源:PostsController.php

示例4: get_new

 public function get_new()
 {
     $categories = Category::lists('name', 'id');
     $accounts = Account::lists('name', 'id');
     $data = array('new' => true, 'categories' => $categories, 'accounts' => $accounts);
     $view = View::make('donation.new');
     return $view->nest('form', 'donation.form', $data);
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:8,代码来源:donations.php

示例5: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($username)
 {
     if (credentialsMatch($username)) {
         $categories = Category::lists('id', 'name');
         return View::make('partials/_form', compact('categories'));
     }
     return Redirect::route('login');
 }
开发者ID:ChoiceParalysis,项目名称:Larablog,代码行数:13,代码来源:PostsController.php

示例6: editProduct

 public function editProduct($id)
 {
     if ($product = Product::find($id)) {
         $categories = Category::lists('name', 'id');
         return View::make('admin.editProduct', compact('product'))->withCategories($categories);
     } else {
         # 404 error page
     }
 }
开发者ID:Pixelsltd,项目名称:e-commerce-1,代码行数:9,代码来源:AdminController.php

示例7: run

 public function run()
 {
     $faker = Faker::create();
     $users = User::lists('id');
     $categories = Category::lists('id');
     foreach (range(1, 100) as $index) {
         Post::create(['title' => $faker->sentence(), 'slug' => $faker->slug() . $index, 'body' => $faker->text(), 'body_original' => $faker->text(), 'user_id' => $faker->randomElement($users), 'category_id' => $faker->randomElement($categories), 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString()]);
     }
 }
开发者ID:Kouga-Huang,项目名称:laravel-blog,代码行数:9,代码来源:PostsTableSeeder.php

示例8: run

 public function run()
 {
     DB::table('category_post')->truncate();
     $post_ids = Post::lists('id');
     $category_ids = Category::lists('id');
     $now = date('Y-m-d H:i:s');
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         DB::table('category_post')->insert(['post_id' => $faker->randomElement($post_ids), 'category_id' => $faker->randomElement($category_ids), 'created_at' => $now, 'updated_at' => $now]);
     }
 }
开发者ID:pogliozzy,项目名称:larabase,代码行数:11,代码来源:PostCategoryTableSeeder.php

示例9: __construct

 public function __construct(Ticket $tickets)
 {
     $this->tickets = $tickets;
     $this->beforeFilter('staff');
     // Store attributes array to be used in the functions below.
     $this->attributes = ['staff_users_list' => User::lists('users_username', 'users_id'), 'support_users_list' => User::lists('users_username', 'users_id'), 'categories_list' => Category::lists('categories_name', 'categories_id'), 'priorities_list' => Priority::lists('priorities_name', 'priorities_id'), 'statuses_list' => Status::lists('statuses_name', 'statuses_id')];
     // Add in an 'unassigned' item with an index of 0 to the support users list.
     // This is so we can display this in the view without having to have a database entry for 'unassigned';
     $this->attributes['support_users_list'][0] = 'unassigned';
     // Get current logged in user's auth level.
     $this->user_auth_level = Auth::user()->get_userlevel();
     // Check if current logged in user is Support or Admin user.
     $this->support_check = Auth::user()->isSupport();
 }
开发者ID:noikiy,项目名称:laradesk,代码行数:14,代码来源:TicketsController.php

示例10: create

 /**
  * Show the form for creating a new resource.
  * GET /membermateris/create
  *
  * @return Response
  */
 public function create()
 {
     $categories = Category::lists('title', 'id');
     return View::make('member.materi.create', compact('categories'));
 }
开发者ID:rizqon,项目名称:ta,代码行数:11,代码来源:MemberMaterisController.php

示例11: getIndex

 public function getIndex()
 {
     $categories = Category::lists('name', 'id');
     return View::make('products.index')->with('products', Product::all())->with(compact('categories'));
 }
开发者ID:y471n,项目名称:laravel-ecomm,代码行数:5,代码来源:ProductsController.php

示例12: getIndex

 public function getIndex()
 {
     $products = Product::all();
     $categories = Category::lists('name', 'id');
     return View::make('products.index')->with('products', $products)->with('categories', $categories);
 }
开发者ID:Manthan787,项目名称:astitvastore,代码行数:6,代码来源:ProductsController.php

示例13: get_edit

 public function get_edit($id)
 {
     $post = Post::find($id);
     return View::make('posts.edit')->with('title', $post->title . 'Edit - Mayaten.com Blog')->with('post', Post::find($id))->with('categories', Category::lists('name', 'id'))->with('recent_comments', Comment::order_by('created_at', 'desc')->get());
 }
开发者ID:reeceballano,项目名称:Mayaten-Blog,代码行数:5,代码来源:posts.php

示例14: function

	if (Auth::attempt(array('email' => $email, 'password' => $password)))
	{
		return Redirect::intended('blog/create');
	}
});*/
Route::group(['before' => 'auth', 'prefix' => 'admin'], function () {
    /*Route::get('admin/logout', 'AuthController@logout');*/
    Route::get('/', 'AuthController@in');
    Route::post('/', 'AuthController@out');
});
Route::get('users/register', 'UserController@getRegister');
Route::post('users/register', 'UserController@postRegister');
Route::get('login', 'UserController@getLogin');
Route::post('login', 'UserController@postLogin');
Route::get('logout', 'UserController@getLogout');
Route::get('blog/create', ['before' => 'auth', 'as' => 'blog.create', 'uses' => function () {
    $categories = Category::lists('name', 'id');
    $user_id = Auth::user()->id;
    return View::make('blog/create')->with("categories", $categories)->with('user_id', $user_id);
}]);
Route::post('blog/create', ['before' => 'csrf|auth', 'as' => 'blog.post.create', 'uses' => function () {
    $post = Input::except('_token');
    $rules = ['title' => 'required', 'body' => 'required', 'category_id' => 'required', 'user_id' => 'required'];
    $validator = Validator::make($post, $rules);
    if ($validator->fails()) {
        return Redirect::route('blog.create')->withInput()->withErrors($validator);
    } else {
        Post::create($post);
        return Redirect::to('blog/show');
    }
}]);
开发者ID:phyowailinn,项目名称:lara-vel,代码行数:31,代码来源:routes.php

示例15: subcategory

 /**
  *
  * @param $subcategoryId int
  * @return nothing
  * @author Tremor
  */
 public function subcategory($subcategoryId = 0)
 {
     $this->data['active'] = __FUNCTION__;
     if (isset($subcategoryId) && !empty($subcategoryId) && is_numeric($subcategoryId)) {
         $this->data['categoryList'] = Category::lists('name', 'id');
         $this->data['subcategory'] = Subcategory::find($subcategoryId);
         return View::make('admin.subcategory.one')->with($this->data);
     } else {
         $this->data['subcategoryList'] = Subcategory::orderBy('sort', 'asc')->get();
         return View::make('admin.subcategory.list')->with($this->data);
     }
 }
开发者ID:tremor-od,项目名称:pizza.loc,代码行数:18,代码来源:AdminController.php


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