Skip to content

Commit

Permalink
Actualización de plantilla
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro-ser committed May 8, 2020
1 parent 4c40492 commit b46cfec
Show file tree
Hide file tree
Showing 22 changed files with 1,400 additions and 377 deletions.
6 changes: 5 additions & 1 deletion app/Http/Controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ public function search(Request $request)
{
$query = $request->input('query');

$products = Product::where('name','LIKE',"%$query%")->paginate(12);
$products = Product::where('name','LIKE',"%$query%")->paginate(15);

return view('product.catalog', compact('products'));
}

public function show(Product $product) {
return view('product.show', compact('product'));
}
}
10 changes: 10 additions & 0 deletions app/ProductCategories.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ProductCategories extends Model
{
//
}
13 changes: 13 additions & 0 deletions database/factories/ProductCategoriesFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\ProductCategories;
use Faker\Generator as Faker;

$factory->define(ProductCategories::class, function (Faker $faker) {
return [
'product_id' => $faker->numberBetween(1, 50),
'category_id' => $faker->numberBetween(3, 29)
];
});
6 changes: 4 additions & 2 deletions database/factories/ProductFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
$factory->define(Product::class, function (Faker $faker) {
return [
'name' => $faker->sentence(2),
'description' => $faker->sentence(20),
'price' => $faker->numberBetween(100, 3000)
'description' => $faker->sentence(8),
'price' => $faker->numberBetween(100, 3000),
'cover_img' => 'default-product-'.$faker->numberBetween(1, 5).'.jpg',
'shop_id' => $faker->numberBetween(1, 2)
];
});
254 changes: 237 additions & 17 deletions database/seeds/CategoriesTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,271 @@ public function run()
array (
'created_at' => '2020-05-06 10:12:14',
'id' => 3,
'name' => 'Men',
'name' => 'Electronic devices',
'order' => 1,
'parent_id' => NULL,
'slug' => 'men',
'updated_at' => '2020-05-06 10:12:31',
'slug' => 'electronic-devices',
'updated_at' => '2020-05-07 13:58:59',
),
1 =>
array (
'created_at' => '2020-05-06 10:13:34',
'id' => 4,
'name' => 'Watch',
'name' => 'Home',
'order' => 1,
'parent_id' => 3,
'slug' => 'watch',
'updated_at' => '2020-05-06 10:13:34',
'parent_id' => NULL,
'slug' => 'home',
'updated_at' => '2020-05-07 13:59:52',
),
2 =>
array (
'created_at' => '2020-05-06 10:13:50',
'id' => 5,
'name' => 'Women',
'name' => 'Groceries',
'order' => 1,
'parent_id' => NULL,
'slug' => 'women',
'updated_at' => '2020-05-06 10:13:50',
'slug' => 'groceries',
'updated_at' => '2020-05-07 14:01:48',
),
3 =>
array (
'created_at' => '2020-05-06 10:15:06',
'id' => 6,
'name' => 'Cosmetics',
'name' => 'Men',
'order' => 1,
'parent_id' => 5,
'slug' => 'cosmetics',
'updated_at' => '2020-05-06 10:15:06',
'parent_id' => NULL,
'slug' => 'men',
'updated_at' => '2020-05-07 14:02:17',
),
4 =>
array (
'created_at' => '2020-05-06 10:15:53',
'id' => 7,
'name' => 'Lipsticks',
'name' => 'Women',
'order' => 1,
'parent_id' => NULL,
'slug' => 'women',
'updated_at' => '2020-05-07 14:02:50',
),
5 =>
array (
'created_at' => '2020-05-07 14:04:53',
'id' => 8,
'name' => 'Top',
'order' => 1,
'parent_id' => NULL,
'slug' => 'top',
'updated_at' => '2020-05-07 14:04:53',
),
6 =>
array (
'created_at' => '2020-05-07 14:05:51',
'id' => 9,
'name' => 'Mobiles',
'order' => 1,
'parent_id' => 3,
'slug' => 'mobiles',
'updated_at' => '2020-05-07 14:05:51',
),
7 =>
array (
'created_at' => '2020-05-07 14:06:34',
'id' => 10,
'name' => 'Laptops',
'order' => 1,
'parent_id' => 3,
'slug' => 'laptops',
'updated_at' => '2020-05-07 14:06:34',
),
8 =>
array (
'created_at' => '2020-05-07 14:06:54',
'id' => 11,
'name' => 'Cameras',
'order' => 1,
'parent_id' => 3,
'slug' => 'cameras',
'updated_at' => '2020-05-07 14:06:54',
),
9 =>
array (
'created_at' => '2020-05-07 14:10:11',
'id' => 12,
'name' => 'Smartphones',
'order' => 1,
'parent_id' => 9,
'slug' => 'smartphones',
'updated_at' => '2020-05-07 14:10:11',
),
10 =>
array (
'created_at' => '2020-05-07 14:10:33',
'id' => 13,
'name' => 'Tablets',
'order' => 1,
'parent_id' => 9,
'slug' => 'tablets',
'updated_at' => '2020-05-07 14:10:33',
),
11 =>
array (
'created_at' => '2020-05-07 14:11:04',
'id' => 14,
'name' => 'Gamming',
'order' => 1,
'parent_id' => 10,
'slug' => 'gamming',
'updated_at' => '2020-05-07 14:11:04',
),
12 =>
array (
'created_at' => '2020-05-07 14:29:11',
'id' => 15,
'name' => 'Televisions',
'order' => 1,
'parent_id' => 4,
'slug' => 'televisions',
'updated_at' => '2020-05-07 14:29:11',
),
13 =>
array (
'created_at' => '2020-05-07 14:29:35',
'id' => 16,
'name' => 'TV',
'order' => 1,
'parent_id' => 15,
'slug' => 'tv',
'updated_at' => '2020-05-07 14:29:35',
),
14 =>
array (
'created_at' => '2020-05-07 14:29:50',
'id' => 17,
'name' => 'Smart',
'order' => 1,
'parent_id' => 15,
'slug' => 'smart',
'updated_at' => '2020-05-07 14:29:50',
),
15 =>
array (
'created_at' => '2020-05-07 14:30:41',
'id' => 18,
'name' => 'Beverages',
'order' => 1,
'parent_id' => 5,
'slug' => 'beverages',
'updated_at' => '2020-05-07 14:30:41',
),
16 =>
array (
'created_at' => '2020-05-07 14:34:47',
'id' => 19,
'name' => 'Coffee',
'order' => 1,
'parent_id' => 18,
'slug' => 'coffee',
'updated_at' => '2020-05-07 14:34:47',
),
17 =>
array (
'created_at' => '2020-05-07 14:35:14',
'id' => 20,
'name' => 'Tea',
'order' => 1,
'parent_id' => 18,
'slug' => 'tea',
'updated_at' => '2020-05-07 14:35:14',
),
18 =>
array (
'created_at' => '2020-05-07 14:35:29',
'id' => 21,
'name' => 'Juices',
'order' => 1,
'parent_id' => 18,
'slug' => 'juices',
'updated_at' => '2020-05-07 14:35:29',
),
19 =>
array (
'created_at' => '2020-05-07 14:59:15',
'id' => 22,
'name' => 'Clothing',
'order' => 1,
'parent_id' => 6,
'slug' => 'lipsticks',
'updated_at' => '2020-05-06 10:15:53',
'slug' => 'clothing-men',
'updated_at' => '2020-05-07 14:59:15',
),
20 =>
array (
'created_at' => '2020-05-07 14:59:55',
'id' => 23,
'name' => 'Clothing',
'order' => 1,
'parent_id' => 7,
'slug' => 'clothing-women',
'updated_at' => '2020-05-07 14:59:55',
),
21 =>
array (
'created_at' => '2020-05-07 15:02:27',
'id' => 24,
'name' => 'Jackets',
'order' => 1,
'parent_id' => 22,
'slug' => 'jackets',
'updated_at' => '2020-05-07 15:02:27',
),
22 =>
array (
'created_at' => '2020-05-07 15:03:28',
'id' => 25,
'name' => 'Shirts',
'order' => 1,
'parent_id' => 22,
'slug' => 'shirts',
'updated_at' => '2020-05-07 15:03:28',
),
23 =>
array (
'created_at' => '2020-05-07 15:03:57',
'id' => 26,
'name' => 'Jeans',
'order' => 1,
'parent_id' => 22,
'slug' => 'jeans',
'updated_at' => '2020-05-07 15:03:57',
),
24 =>
array (
'created_at' => '2020-05-07 15:04:51',
'id' => 27,
'name' => 'Tops',
'order' => 1,
'parent_id' => 23,
'slug' => 'tops',
'updated_at' => '2020-05-07 15:04:51',
),
25 =>
array (
'created_at' => '2020-05-07 15:05:12',
'id' => 28,
'name' => 'Shorts',
'order' => 1,
'parent_id' => 23,
'slug' => 'shorts',
'updated_at' => '2020-05-07 15:05:12',
),
26 =>
array (
'created_at' => '2020-05-07 15:05:32',
'id' => 29,
'name' => 'Skirts',
'order' => 1,
'parent_id' => 23,
'slug' => 'skirts',
'updated_at' => '2020-05-07 15:05:32',
),
));

Expand Down
Loading

0 comments on commit b46cfec

Please sign in to comment.