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


PHP Category::get方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $categories = Category::get();
     $heading = 'Categories';
     return view('admin.categories', array('categories' => $categories, 'heading' => $heading));
 }
开发者ID:matthiku,项目名称:LaravelWithSocialite,代码行数:12,代码来源:CategoryController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($idlevel, $level, $idspeciality, $speciality, $idmaterial, $material, $idlesson, $lesson)
 {
     $newsallarticles = Article::where('stat', '=', 'nouvelles')->orderBy('id', 'desc')->take(3)->get();
     $bacallarticles = Article::where('stat', '=', 'apres-bac')->orderBy('id', 'desc')->take(3)->get();
     $speciality = str_replace('-', ' ', $speciality);
     $material = str_replace('-', ' ', $material);
     $lesson = str_replace('-', ' ', $lesson);
     $lessonnames = Lesson::where('id', '=', $idlesson)->get();
     $specialitynames = Category::where('id', '=', $idspeciality)->get();
     $alllessons = Lesson::groupBy('categories_id')->orderBy('id', 'desc')->get();
     $rounds1 = Lesson::where('round', '=', '1ere-session')->get();
     $rounds2 = Lesson::where('round', '=', '2eme-session')->get();
     $fullcat = Category::get();
     $all = Category::where('parent', '=', 0);
     $level = str_replace('-', ' ', $level);
     $levelnames = Category::where('id', '=', $idlevel)->get();
     $materialnames = Category::where('id', '=', $idmaterial)->get();
     foreach ($lessonnames as $lessonname) {
         $ar_lessonname = $lessonname->ar_title;
     }
     foreach ($specialitynames as $specialityname) {
         $ar_specialityname = $specialityname->ar_name;
     }
     foreach ($levelnames as $levelname) {
         $ar_levelname = $levelname->ar_name;
     }
     foreach ($materialnames as $materialname) {
         $ar_materialname = $materialname->ar_name;
     }
     return view(proj . '.resumes', ['title' => $ar_lessonname, 'ar_materialname' => $ar_materialname, 'ar_levelname' => $ar_levelname, 'rounds1' => $rounds1, 'rounds2' => $rounds2, 'asccat' => $all->get(), 'allcat' => $all->orderBy('id', 'desc')->get(), 'fullcat' => $fullcat, 'idlevel' => $idlevel, 'idspeciality' => $idspeciality, 'idmaterial' => $idmaterial, 'idlesson' => $idlesson, 'level' => $level, 'newsallarticles' => $newsallarticles, 'bacallarticles' => $bacallarticles, 'alllessons' => $alllessons, 'ar_lessonname' => $ar_lessonname, 'lesson' => $lesson, 'material' => $material, 'ar_specialityname' => $ar_specialityname, 'speciality' => $speciality]);
 }
开发者ID:ewaschool,项目名称:dirassa,代码行数:36,代码来源:Resume.php

示例3: challenges

 public function challenges()
 {
     $startd = DB::table('Games')->select('start')->first();
     $endd = DB::table('Games')->select('stop')->first();
     if ($startd->start > Carbon::now()) {
         return view("pages.countdown");
     } elseif ($endd->stop < Carbon::now()) {
         return view('pages.closed');
     }
     $num_users = User::count();
     $completed = Submitted_flag::count();
     $num_challenges = Challenge::count();
     $average_c = $completed / $num_users / $num_challenges * 100;
     $stats = array('num_users' => $num_users, 'completed' => $completed, 'average' => $average_c);
     $mycompleted = Submitted_flag::where('user_id', Auth::user()->id)->get()->toArray();
     $game = Game::first();
     $categories = Category::get();
     $categories = $categories->toArray();
     foreach ($categories as $category) {
         $challenges = Challenge::where('category_id', $category['id'])->orderby('point_value', 'ASC')->get()->toArray();
         $categories[(int) $category['id'] - 1]['challenges'] = $challenges;
     }
     $directory = base_path() . '/public/Challenges_Repo/';
     $files = scandir($directory);
     $startd = DB::table('Games')->select('start')->first();
     if ($startd->start > Carbon::now()) {
         $start = true;
     } else {
         $start = false;
     }
     $data = array('user' => Auth::user(), 'game' => $game, 'categories' => $categories, 'stats' => $stats, 'files' => $files, 'completed' => $mycompleted, 'start' => $start);
     return view("pages.challenges")->with('data', $data);
 }
开发者ID:Kanesol,项目名称:CTF-Challenge,代码行数:33,代码来源:DynamicController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = FeaturedProduct::orderBy('rank', 'asc')->with('product')->get();
     $categories = Category::get();
     $products = Product::get();
     return view('admin.image.featured-product', compact('data', 'categories', 'products'));
 }
开发者ID:nguyentantintb,项目名称:wedding-card,代码行数:12,代码来源:FeaturedProductController.php

示例5: challenges

 public function challenges()
 {
     /*$game = Game::first();
             $categories = Category::get();
             $categories = $categories->toArray();
     
             foreach($categories as $category)
             {
                 $challenges = Challenge::where('category_id', $category['id'])->get()->toArray();
                 $categories[(int)$category['id'] - 1]['challenges'] =  $challenges;
             }
     
     
             $data = array('game' => $game, 'categories' => $categories);*/
     $num_users = User::count();
     $completed = Submitted_flag::count();
     $num_challenges = Challenge::count();
     $average_c = $completed / $num_users / $num_challenges * 100;
     $stats = array('num_users' => $num_users, 'completed' => $completed, 'average' => $average_c);
     $game = Game::first();
     $categories = Category::get();
     $categories = $categories->toArray();
     foreach ($categories as $category) {
         $challenges = Challenge::where('category_id', $category['id'])->get()->toArray();
         $categories[(int) $category['id'] - 1]['challenges'] = $challenges;
     }
     $directory = base_path() . '/public/Challenges_Repo/';
     $files = scandir($directory);
     $data = array('user' => Auth::user(), 'game' => $game, 'categories' => $categories, 'stats' => $stats, 'files' => $files);
     return view("pages.challenges")->with('data', $data);
 }
开发者ID:Gustibimo,项目名称:CTF-Challenge,代码行数:31,代码来源:DynamicController.php

示例6: getUserstable

 public function getUserstable()
 {
     $users = \App\User::all();
     $roles = \DB::table('roles')->select('id', 'role_title')->get();
     $root_categories = \App\Category::whereIsRoot()->get();
     $categories = \App\Category::get();
     return \Response::json(\View::make('partials.userstable', compact('users', 'roles', 'root_categories', 'categories'))->render(), 200);
 }
开发者ID:alexandermakedonski,项目名称:hoursystem,代码行数:8,代码来源:AccountController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $product = Product::find($id);
     $seasons = Season::pluck('slug', 'id')->toArray();
     $materials = Material::pluck('name_ru', 'id');
     $categories = Category::get()->linknodes()->pluck('name_ru', 'id');
     return response()->view('back.products.edit', compact('product', 'seasons', 'materials', 'categories'));
 }
开发者ID:yurilabatsevich,项目名称:test.dev,代码行数:14,代码来源:ProductsController.php

示例8: index

 public function index()
 {
     //$books = Book::available()->orderByTitle()->lists('title', 'id');
     $students = Student::notLimit()->active()->orderByName()->lists('name', 'id');
     //$categories = Category::lists('category', 'id');
     $categories = Category::get();
     return view('lms.peminjaman.peminjaman', compact('students', 'categories'));
 }
开发者ID:arooth,项目名称:Library-Management-System,代码行数:8,代码来源:PeminjamanController.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $categories = Category::get()->lists('id')->all();
     $product_name = $faker->word;
     foreach (range(1, 25) as $index) {
         $products = Product::create(['product_name' => $product_name, 'product_price' => $faker->numberBetween(2), 'long_description' => $faker->paragraph(3), 'short_description' => $faker->sentence(6), 'meta_description' => $faker->sentence(1), 'is_active' => $faker->boolean(50), 'category_id' => $faker->randomElement($categories), 'slug' => $product_name]);
     }
 }
开发者ID:Reached,项目名称:webshop,代码行数:14,代码来源:ProductsTableSeeder.php

示例10: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $cats = [];
     $categories = [];
     $cats = Category::get(['id', 'name']);
     foreach ($cats as $cat) {
         $categories[$cat->id] = $cat->name;
     }
     return View('negocios.create', compact('categories'));
 }
开发者ID:FRKodes,项目名称:ekonexion,代码行数:15,代码来源:NegociosController.php

示例11: editNegocio

 public function editNegocio($id)
 {
     $negocio = Negocio::find($id);
     $cats = [];
     $categories = [];
     $cats = Category::get(['id', 'name']);
     foreach ($cats as $cat) {
         $categories[$cat->id] = $cat->name;
     }
     return View('admin.negocio', compact('negocio', 'categories'));
 }
开发者ID:FRKodes,项目名称:ekonexion,代码行数:11,代码来源:AdminController.php

示例12: organization

 public function organization($start, $end)
 {
     $chart = new Highchart();
     $categories = Category::get(['name']);
     $requests = DB::table('requests AS r')->select(['o.name AS name', 'c.name AS category'])->join('users AS u', 'r.submitted_by', '=', 'u.id')->join('organizations AS o', 'r.organization_id', '=', 'o.id')->join('categories AS c', 'c.id', '=', 'r.category_id')->whereRaw("requested_on BETWEEN DATE_SUB('" . $start . "', INTERVAL 1 DAY) AND DATE_ADD('" . $end . "', INTERVAL 1 DAY)")->get();
     if (empty($requests)) {
         $json = ['status' => 'error', 'title' => 'Error', 'message' => 'No data was found within the date range selected!'];
         return $json;
     }
     foreach ($requests as $request) {
         foreach ($categories as $cat) {
             $array[$request->name][$cat->name] = 0;
         }
     }
     foreach ($requests as $request) {
         $array[$request->name][$request->category]++;
     }
     foreach ($array as $key => $value) {
         $displayOrg[] = $key;
         foreach ($value as $cat => $total) {
             $totals[$cat][] = $total;
         }
     }
     foreach ($totals as $key => $package) {
         foreach ($package as $value) {
             $data[] = $value;
         }
         $chart->series[] = array('name' => $key, 'data' => $data);
         unset($data);
     }
     foreach ($requests as $request) {
         @$orgs[$request->requester->organization->name]++;
     }
     arsort($orgs);
     $chart->yAxis->stackLabels->enabled = 1;
     $chart->plotOptions->column->stacking = "normal";
     $chart->plotOptions->column->dataLabels->enabled = 1;
     $chart->credits->enabled = false;
     $chart->chart = array('type' => 'column');
     //$chart->colors = array(
     //	"#A2DED0"
     //);
     $chart->title = array('text' => '');
     //$chart->legend->enabled = false;
     $chart->xAxis->categories = $displayOrg;
     $chart->yAxis = array('title' => array('text' => '# of requests'));
     echo $chart->renderOptions();
 }
开发者ID:gfdeveloper,项目名称:LCCB,代码行数:48,代码来源:ReportsController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($news, $idarticle, $article)
 {
     $all = Category::where('parent', '=', 0);
     $newsarticles = Article::orderBy('id', 'desc')->where('stat', '=', 'nouvelles')->take(5)->get();
     $bacarticles = Article::orderBy('id', 'desc')->where('stat', '=', 'apres-bac')->take(5)->get();
     $news = str_replace('-', ' ', $news);
     $arnews = Category::where('fr_name', '=', $news)->get();
     foreach ($arnews as $new) {
         $ar_news = $new->ar_name;
     }
     $fullcat = Category::get();
     $findarticles = Article::where('id', '=', $idarticle)->get();
     $newsallarticles = Article::where('stat', '=', 'nouvelles')->orderBy('id', 'desc')->take(3)->get();
     $bacallarticles = Article::where('stat', '=', 'apres-bac')->orderBy('id', 'desc')->take(3)->get();
     return view(proj . '.news_articles', ['title' => $article, 'newsallarticles' => $newsallarticles, 'bacallarticles' => $bacallarticles, 'newsarticles' => $newsarticles, 'bacarticles' => $bacarticles, 'asccat' => $all->get(), 'allcat' => $all->orderBy('id', 'desc')->get(), 'findarticles' => $findarticles, 'fullcat' => $fullcat, 'idarticle' => $idarticle, 'article' => $article, 'ar_news' => $ar_news, 'news' => $news]);
 }
开发者ID:ewaschool,项目名称:dirassa,代码行数:21,代码来源:Showarticles.php

示例14: index

 public function index()
 {
     return Category::get()->map(function ($category) {
         return new CategoryAPIObject($category);
     });
 }
开发者ID:nathman,项目名称:nzhosts,代码行数:6,代码来源:CategoriesController.php

示例15: getCategory

 public function getCategory()
 {
     $categoryData = Category::get();
     if ($categoryData) {
         $Response = array('success' => '1', 'category' => $categoryData);
     } else {
         $Response = array('success' => '0', 'error' => 'No Category Found');
     }
     return $Response;
 }
开发者ID:sulthan-wekancode,项目名称:greenhopping,代码行数:10,代码来源:AppController.php


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