Пример #1
0
 public function getIndex()
 {
     $categories = array();
     foreach (Categories::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return View::make('product.index')->with('product', Product::all())->with('categories', $categories);
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     //Products::truncate();
     $suppliers = Suppliers::all()->lists('id');
     $categories = Categories::all()->lists('id');
     for ($i = 0; $i < 20; $i++) {
         $products = Products::create(array('name' => $faker->word, 'quantity' => $faker->numberBetween(1, 900), 'unitPrice' => $faker->randomFloat(5, 1, 5000), 'details' => $faker->text, 'color' => $faker->colorName, 'supplierProductId' => $faker->randomNumber, 'supplierId' => $faker->randomElement($suppliers), 'categoryId' => $faker->randomElement($categories)));
     }
 }
 public function index()
 {
     if (Input::get('search') != null) {
         $cat = new Categories();
         return $this->search(Input::get('search'));
     } else {
         $categories = Categories::all();
         return View::make('categories.index')->with('categories', $categories);
     }
 }
Пример #4
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         View::share('catnav', Categories::all());
     });
 }
 public function getIndex()
 {
     return View::make('categories.index')->with('categories', Categories::all());
 }
Пример #6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $Category = Categories::all()->toJson();
     return $this->response(array('statusCode' => 100, 'statusDescription' => "Success", 'Categorys' => json_decode($Category, true)));
 }
Пример #7
0
 public function getViewCategory()
 {
     $categories = Categories::all();
     $data = array('userData' => $this->userData, 'pageTitle' => 'View Category', 'listcategories' => $categories);
     return View::make('admin.viewcategory', $data);
 }