/**
  * 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));
 }
示例#2
0
 /**
  * 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]);
 }
 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);
 }
 /**
  * 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'));
 }
 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);
 }
 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);
 }
 /**
  * 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'));
 }
 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'));
 }
示例#9
0
 /**
  * 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]);
     }
 }
示例#10
0
 /**
  * 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'));
 }
示例#11
0
 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'));
 }
示例#12
0
 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();
 }
示例#13
0
 /**
  * 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]);
 }
示例#14
0
 public function index()
 {
     return Category::get()->map(function ($category) {
         return new CategoryAPIObject($category);
     });
 }
 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;
 }
示例#16
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['news_title' => 'required', 'news_text' => 'required']);
     $news = News::find($id);
     $news->is_published = $request->get('is_published') == 'on' ? 1 : 0;
     $news->title = $request->get('news_title');
     $news->text = $request->get('news_text');
     $news->save();
     $news->categories()->detach();
     if ($request->get('news_categories') != null) {
         foreach ($request->get('news_categories') as $category_id) {
             $news->categories()->attach($category_id);
         }
     }
     Session::flash('flash_message', 'Event successfully added!');
     return view('dashboard/create_news')->with('success', 1)->with('categories', Category::get())->with('news', $news);
 }
 /**
  * Display a listing of the category
  */
 public function getIndex()
 {
     $categories = Category::get();
     return view('admin/category/listCategory', array('user' => $this->username, 'nav_category' => '', 'categories' => $categories));
 }
示例#18
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     //
     return view('categories.index')->with('categories', Category::get());
 }
示例#19
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $cat = Category::get();
     return $cat;
 }
示例#20
0
<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)];
});
$factory->define(\App\Category::class, function (Faker\Generator $faker) {
    return ['category' => $faker->sentence, 'path_img' => $faker->imageUrl(400, 500, 'food'), 'color' => $faker->hexColor];
});
$factory->define(\App\Task::class, function (Faker\Generator $faker) {
    return ['name' => $faker->sentence, 'description' => $faker->paragraph(2), 'user_id' => $faker->randomElement(\App\User::get()->lists('id')->toArray()), 'category_id' => $faker->randomElement(\App\Category::get()->lists('id')->toArray()), 'status' => $faker->boolean(20)];
});
 private function getCategories()
 {
     // get list (array) of categories
     $cats = Category::get();
     $categories = [];
     foreach ($cats as $cat) {
         $categories[$cat->id] = $cat->name;
     }
     return $categories;
 }
 /**
  * Get single event by id
  */
 public function getEdit($id, $page)
 {
     $event = Event::find($id);
     $categories = Category::get();
     return view('admin/event/editEvent', array('user' => $this->username, 'nav_new_post' => '', 'categories' => $categories, 'event' => $event, 'page' => $page));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $title = 'View All Category';
     $categories = Category::get();
     return view('private.category.index', compact('title', 'categories'));
 }
示例#24
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $product = Product::with('categories')->where('id', $id)->first();
     return view('dashboard/edit_product')->with('categories', Category::get())->with("product", $product);
 }
 public function index()
 {
     $result = Category::get()->toTree();
     return \Response::json($result);
 }
示例#26
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $event = Event::find($id);
     return view('dashboard/edit_event')->with('categories', Category::get())->with("event", $event);
 }
示例#27
0
 public function buildTree($parent_id = 'category_id', $children = 'children', $list = null)
 {
     return parent::buildTree($parent_id, $children, $list ?: Category::get());
 }
示例#28
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = Category::get()->toJson();
     return view('pages.index')->with('cats', $categories);
 }
 /**
  * 获取category
  */
 public function category()
 {
     $category = Category::get();
     $n = count($category);
     for ($i = 0; $i < $n; ++$i) {
         $category[$i]->messages_num = Message::where('category', $category[$i]->id)->count();
     }
     return $category;
 }
 public function index()
 {
     $categories = Category::get();
     return view('lms.settings.category.category', compact('categories'));
 }