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


PHP Category::whereNull方法代码示例

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


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

示例1: getCreate

 /**
  * Страница создания категории.
  *
  * @return \Illuminate\View\View
  */
 public function getCreate()
 {
     // Ищем фирму по короткому названию
     $data['company'] = Company::whereShortTitle($this->companyName)->first();
     // Возможные родительские категории
     $data['parent_categories'] = Category::whereNull('parent_id')->orderBy('title')->get();
     // Группы категорий
     $data['groups_categories'] = GroupsCategory::whereCompanyId($data['company']->id)->orderBy('title')->get();
     return view('admin.companies.catalog.categories.create', $data);
 }
开发者ID:alexmon1989,项目名称:kadsgroup,代码行数:15,代码来源:CategoriesController.php

示例2: search

 public function search(Request $request)
 {
     $menu = \App\Menu::find(1);
     $search = $request->input('search') ?: '';
     /*$categories = \App\Category::where('level','1')->orderBy('ordering')->get();
       $parentCategory = \App\Category::where('title','like','%'.$search.'%')
                                      ->orWhereIn('parent_id',DB::table('categories')->where('title',$search)->lists('id'))
                                      ->lists('id');*/
     $categories = \App\Category::whereNull('deleted_at')->get();
     $contents = \App\Content::where('title', 'like', '%' . $search . '%')->whereNull('deleted_at')->orderBy('created_at')->paginate(21);
     return view('project_list')->with(['category' => '', 'categories' => $categories, 'contents' => $contents, 'menu' => $menu]);
 }
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:12,代码来源:CategoryController.php

示例3: function

 Route::get('/projectsinfo', function () {
     return view('project_info');
 });
 Route::get('/about', function () {
     return view('about');
 });
 Route::get('/home', function () {
     return view('welcome');
 });
 Route::get('menu/{menuId}/categories/{categoryId}/projects/{projectId?}', function ($menuId, $categoryId, $projectId = '') {
     $menu = \App\Menu::find($menuId);
     $category = \App\Category::find($categoryId);
     $categories = \App\Category::where('level', '1')->where('parent_id', $menu->internal_url)->whereNull('deleted_at')->orderBy('ordering')->get();
     if ($projectId == '') {
         $parentCategory = \App\Category::where('parent_id', $categoryId)->orWhereIn('parent_id', DB::table('categories')->where('parent_id', $categoryId)->whereNull('deleted_at')->lists('id'))->whereNull('deleted_at')->lists('id');
         $parentCategorySup = \App\Category::whereNull('deleted_at')->where('parent_id', 'in', implode(' ,', $parentCategory->toArray()))->lists('id');
         $contents = \App\Content::where('category_id', $categoryId)->orWhereIn('category_id', $parentCategory->toArray())->whereNull('deleted_at')->orderBy('created_at')->paginate(21);
         return view('project_list')->with(['category' => $category, 'categories' => $categories, 'contents' => $contents, 'menu' => $menu]);
     } else {
         $content = \App\Content::find($projectId);
         return view('project_info')->with(['category' => $category, 'categories' => $categories, 'content' => $content, 'menu' => $menu]);
     }
 })->where(['menuId' => '[0-9]+', 'categoryId' => '[0-9]+', 'projectId' => '[0-9]+']);
 Route::get('categories/projects/search', 'CategoryController@search');
 Route::post('menu/{menuId}/categories/{categoryId}/projects', function ($menuId, $categoryId) {
     $parentCategory = \App\Category::where('parent_id', $categoryId)->orWhereIn('parent_id', DB::table('categories')->where('parent_id', $categoryId)->lists('id'))->whereNull('deleted_at')->lists('id');
     $contents = \App\Content::where('category_id', $categoryId)->orWhereIn('category_id', $parentCategory->toArray())->whereNull('deleted_at')->orderBy('created_at')->paginate(21);
     $data = View('project_list_template')->with(['contents' => $contents, 'menu' => \App\Menu::find($menuId)])->render();
     return response()->json($data);
 });
 Route::get('locale/{locale?}', ['as' => 'locale.setocale', 'uses' => 'LocaleController@setLocale']);
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:31,代码来源:routes.php


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