Passed
Pull Request — master (#7)
by Ron
09:11 queued 05:25
created
database/factories/ProductFactory.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,38 +11,38 @@
 block discarded – undo
11 11
 use Illuminate\Support\Str;
12 12
 use Faker\Generator as Faker;
13 13
 
14
-$factory->define(Product::class, function (Faker $faker) {
14
+$factory->define(Product::class, function(Faker $faker) {
15 15
 	return [
16 16
 		'category_id' => factory(Category::class)->create()->id,
17
-		'name' => $faker->words(rand(1,3), true),
17
+		'name' => $faker->words(rand(1, 3), true),
18 18
 		'short_description' => $faker->sentences(5, true),
19 19
 		'description' => $faker->sentences(10, true),
20 20
 		'is_active' => true
21 21
 	];
22 22
 });
23 23
 
24
-$factory->define(Attribute::class, function (Faker $faker) {
24
+$factory->define(Attribute::class, function(Faker $faker) {
25 25
 	return [
26 26
 		'product_id' => null, // it should be attach manually
27 27
 		'name' => $faker->word
28 28
 	];
29 29
 });
30 30
 
31
-$factory->define(AttributeValue::class, function (Faker $faker) {
31
+$factory->define(AttributeValue::class, function(Faker $faker) {
32 32
 	return [
33 33
 		'product_attribute_id' => null, // it should be attach manually
34 34
 		'value' => $faker->word
35 35
 	];
36 36
 });
37 37
 
38
-$factory->define(ProductSku::class, function (Faker $faker) {
38
+$factory->define(ProductSku::class, function(Faker $faker) {
39 39
 	return [
40 40
 		'product_id' => null, // it should be manually added
41 41
 		'code' => Str::random()
42 42
 	];
43 43
 });
44 44
 
45
-$factory->define(ProductVariant::class, function (Faker $faker) {
45
+$factory->define(ProductVariant::class, function(Faker $faker) {
46 46
 	return [
47 47
 		'product_id' => null, // it should be manually added
48 48
 		'product_sku_id' => null, // it should be manually added
Please login to merge, or discard this patch.
database/factories/WarehouseFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 use Ronmrcdo\Inventory\Models\Warehouse;
4 4
 use Faker\Generator as Faker;
5 5
 
6
-$factory->define(Warehouse::class, function (Faker $faker) {
6
+$factory->define(Warehouse::class, function(Faker $faker) {
7 7
 	return [
8 8
 		'name' => $faker->word,
9 9
 		'description' => $faker->words(3, true)
Please login to merge, or discard this patch.
src/Resources/AttributeResource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 		return [
12 12
 			'id' => $this->id,
13 13
 			'name' => $this->name,
14
-			'options' => collect($this->values)->map(function ($item) {
14
+			'options' => collect($this->values)->map(function($item) {
15 15
 				return $item->value;
16 16
 			})->values()->toArray()
17 17
 		];
Please login to merge, or discard this patch.
src/Resources/VariantResource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 				'id' => $this->product->category_id,
22 22
 				'name' => $this->product->category->name
23 23
 			],
24
-			'attributes' => collect($this->variant)->map(function ($item) {
24
+			'attributes' => collect($this->variant)->map(function($item) {
25 25
 				return [
26 26
 					'name' => $item->attribute->name,
27 27
 					'option' => $item->option->value
Please login to merge, or discard this patch.
src/Models/InventoryStock.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -10,89 +10,89 @@
 block discarded – undo
10 10
 
11 11
 class InventoryStock extends Model
12 12
 {
13
-    use HasItemStocks;
13
+	use HasItemStocks;
14 14
 
15
-    /**
16
-     * Table name
17
-     * 
18
-     * @var string
19
-     */
20
-    protected $table = 'inventory_stocks';
15
+	/**
16
+	 * Table name
17
+	 * 
18
+	 * @var string
19
+	 */
20
+	protected $table = 'inventory_stocks';
21 21
 
22
-    /**
23
-     * Fields that can be mass assigned
24
-     * 
25
-     * @var array
26
-     */
27
-    protected $fillable = [
28
-        'warehouse_id', 'product_sku_id', 'quantity',
29
-        'aisle', 'row'
30
-    ];
22
+	/**
23
+	 * Fields that can be mass assigned
24
+	 * 
25
+	 * @var array
26
+	 */
27
+	protected $fillable = [
28
+		'warehouse_id', 'product_sku_id', 'quantity',
29
+		'aisle', 'row'
30
+	];
31 31
 
32
-    /**
33
-     * Guarded fields from mass assign
34
-     * 
35
-     * @var array
36
-     */
37
-    protected $guarded = [
38
-        'id', 'created_at', 'updated_at'
39
-    ];
32
+	/**
33
+	 * Guarded fields from mass assign
34
+	 * 
35
+	 * @var array
36
+	 */
37
+	protected $guarded = [
38
+		'id', 'created_at', 'updated_at'
39
+	];
40 40
 
41
-    /**
42
-     * Local Scope to find item by sku on the inventory
43
-     * 
44
-     * @param \Illuminate\Database\Eloquent\Builder $query
45
-     * @param string $sku
46
-     * @return \Illuminate\Database\Eloquent\Builder
47
-     */
48
-    public function scopeFindItemBySku(Builder $query, string $sku): Builder
49
-    {
50
-        return $query->whereHas('product.code', function ($q) use ($sku) {
51
-            $q->where('code', 'LIKE', '%'. $sku .'%');
52
-        });
53
-    }
41
+	/**
42
+	 * Local Scope to find item by sku on the inventory
43
+	 * 
44
+	 * @param \Illuminate\Database\Eloquent\Builder $query
45
+	 * @param string $sku
46
+	 * @return \Illuminate\Database\Eloquent\Builder
47
+	 */
48
+	public function scopeFindItemBySku(Builder $query, string $sku): Builder
49
+	{
50
+		return $query->whereHas('product.code', function ($q) use ($sku) {
51
+			$q->where('code', 'LIKE', '%'. $sku .'%');
52
+		});
53
+	}
54 54
 
55
-    /**
56
-     * Local scope to find an item based on product name
57
-     * 
58
-     * @param \Illuminate\Database\Eloquent\Builder $query
59
-     * @param string $sku
60
-     * @return \Illuminate\Database\Eloquent\Builder
61
-     */
62
-    public function scopeFindItem(Builder $query, string $product): Builder
63
-    {
64
-        return $query->whereHas('product.product', function ($q) use ($product) {
65
-            return $q->where('name', 'LIKE', '%'. $product .'%');
66
-        });
67
-    }
55
+	/**
56
+	 * Local scope to find an item based on product name
57
+	 * 
58
+	 * @param \Illuminate\Database\Eloquent\Builder $query
59
+	 * @param string $sku
60
+	 * @return \Illuminate\Database\Eloquent\Builder
61
+	 */
62
+	public function scopeFindItem(Builder $query, string $product): Builder
63
+	{
64
+		return $query->whereHas('product.product', function ($q) use ($product) {
65
+			return $q->where('name', 'LIKE', '%'. $product .'%');
66
+		});
67
+	}
68 68
 
69
-    /**
70
-     * Relation to the warehouse
71
-     * 
72
-     * @return \lluminate\Database\Eloquent\Relations\BelongsTo
73
-     */
74
-    public function warehouse(): BelongsTo
75
-    {
76
-        return $this->belongsTo('Ronmrcdo\Inventory\Models\Warehouse');
77
-    }
69
+	/**
70
+	 * Relation to the warehouse
71
+	 * 
72
+	 * @return \lluminate\Database\Eloquent\Relations\BelongsTo
73
+	 */
74
+	public function warehouse(): BelongsTo
75
+	{
76
+		return $this->belongsTo('Ronmrcdo\Inventory\Models\Warehouse');
77
+	}
78 78
 
79
-    /**
80
-     * Relation to the product
81
-     * 
82
-     * @return \lluminate\Database\Eloquent\Relations\BelongsTo
83
-     */
84
-    public function product(): BelongsTo
85
-    {
86
-        return $this->belongsTo('Ronmrcdo\Inventory\Models\ProductSku' ,'product_sku_id');
87
-    }
79
+	/**
80
+	 * Relation to the product
81
+	 * 
82
+	 * @return \lluminate\Database\Eloquent\Relations\BelongsTo
83
+	 */
84
+	public function product(): BelongsTo
85
+	{
86
+		return $this->belongsTo('Ronmrcdo\Inventory\Models\ProductSku' ,'product_sku_id');
87
+	}
88 88
 
89
-    /**
90
-     * Relation to the stock Movements
91
-     * 
92
-     * @return \lluminate\Database\Eloquent\Relations\HasMany
93
-     */
94
-    public function movements(): HasMany
95
-    {
96
-        return $this->hasMany('Ronmrcdo\Inventory\Models\InventoryStockMovement', 'stock_id', 'id');
97
-    }
89
+	/**
90
+	 * Relation to the stock Movements
91
+	 * 
92
+	 * @return \lluminate\Database\Eloquent\Relations\HasMany
93
+	 */
94
+	public function movements(): HasMany
95
+	{
96
+		return $this->hasMany('Ronmrcdo\Inventory\Models\InventoryStockMovement', 'stock_id', 'id');
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function scopeFindItemBySku(Builder $query, string $sku): Builder
49 49
     {
50
-        return $query->whereHas('product.code', function ($q) use ($sku) {
51
-            $q->where('code', 'LIKE', '%'. $sku .'%');
50
+        return $query->whereHas('product.code', function($q) use ($sku) {
51
+            $q->where('code', 'LIKE', '%'.$sku.'%');
52 52
         });
53 53
     }
54 54
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function scopeFindItem(Builder $query, string $product): Builder
63 63
     {
64
-        return $query->whereHas('product.product', function ($q) use ($product) {
65
-            return $q->where('name', 'LIKE', '%'. $product .'%');
64
+        return $query->whereHas('product.product', function($q) use ($product) {
65
+            return $q->where('name', 'LIKE', '%'.$product.'%');
66 66
         });
67 67
     }
68 68
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function product(): BelongsTo
85 85
     {
86
-        return $this->belongsTo('Ronmrcdo\Inventory\Models\ProductSku' ,'product_sku_id');
86
+        return $this->belongsTo('Ronmrcdo\Inventory\Models\ProductSku', 'product_sku_id');
87 87
     }
88 88
 
89 89
     /**
Please login to merge, or discard this patch.
src/Models/Attribute.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public function addValue($value)
49 49
     {
50 50
         if (is_array($value)) {
51
-            $terms = collect($value)->map(function ($term) {
51
+            $terms = collect($value)->map(function($term) {
52 52
                 return ['value' => $term];
53 53
             })
54 54
             ->values()
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,84 +8,84 @@
 block discarded – undo
8 8
 
9 9
 class Attribute extends Model
10 10
 {
11
-    /**
12
-     * Table name of the model
13
-     * 
14
-     * @var string
15
-     */
16
-    protected $table = 'product_attributes';
11
+	/**
12
+	 * Table name of the model
13
+	 * 
14
+	 * @var string
15
+	 */
16
+	protected $table = 'product_attributes';
17 17
 
18
-    /**
19
-     * Disable the timestamp on model creation
20
-     * 
21
-     * @var bool
22
-     */
23
-    public $timestamps = false;
18
+	/**
19
+	 * Disable the timestamp on model creation
20
+	 * 
21
+	 * @var bool
22
+	 */
23
+	public $timestamps = false;
24 24
 
25
-    /**
26
-     * Fields that are mass assignable
27
-     * 
28
-     * @var array
29
-     */
30
-    protected $fillable = [
31
-        'product_id', 'name'
32
-    ];
25
+	/**
26
+	 * Fields that are mass assignable
27
+	 * 
28
+	 * @var array
29
+	 */
30
+	protected $fillable = [
31
+		'product_id', 'name'
32
+	];
33 33
 
34
-    /**
35
-     * Fields that can't be assign
36
-     * 
37
-     * @var array
38
-     */
39
-    protected $guarded = [
40
-        'id'
41
-    ];
34
+	/**
35
+	 * Fields that can't be assign
36
+	 * 
37
+	 * @var array
38
+	 */
39
+	protected $guarded = [
40
+		'id'
41
+	];
42 42
 
43
-    /**
44
-     * Add Value on the attribute
45
-     * 
46
-     * @param string|array $value
47
-     */
48
-    public function addValue($value)
49
-    {
50
-        if (is_array($value)) {
51
-            $terms = collect($value)->map(function ($term) {
52
-                return ['value' => $term];
53
-            })
54
-            ->values()
55
-            ->toArray();
43
+	/**
44
+	 * Add Value on the attribute
45
+	 * 
46
+	 * @param string|array $value
47
+	 */
48
+	public function addValue($value)
49
+	{
50
+		if (is_array($value)) {
51
+			$terms = collect($value)->map(function ($term) {
52
+				return ['value' => $term];
53
+			})
54
+			->values()
55
+			->toArray();
56 56
 
57
-            return $this->values()->createMany($terms);
58
-        }
59
-        return $this->values()->create(['value' => $value]);
60
-    }
57
+			return $this->values()->createMany($terms);
58
+		}
59
+		return $this->values()->create(['value' => $value]);
60
+	}
61 61
 
62
-    /**
63
-     * Remove a term on an attribute
64
-     * 
65
-     * @param string $term
66
-     */
67
-    public function removeValue($term)
68
-    {
69
-        return $this->values()->where('value', $term)->firstOrFail()->delete();
70
-    }
62
+	/**
63
+	 * Remove a term on an attribute
64
+	 * 
65
+	 * @param string $term
66
+	 */
67
+	public function removeValue($term)
68
+	{
69
+		return $this->values()->where('value', $term)->firstOrFail()->delete();
70
+	}
71 71
 
72
-    /**
73
-     * Relation of the attribute to the product
74
-     * 
75
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo $this
76
-     */
77
-    public function product(): BelongsTo
78
-    {
79
-        return $this->belongsTo(config('laravel-inventory.product'));
80
-    }
72
+	/**
73
+	 * Relation of the attribute to the product
74
+	 * 
75
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo $this
76
+	 */
77
+	public function product(): BelongsTo
78
+	{
79
+		return $this->belongsTo(config('laravel-inventory.product'));
80
+	}
81 81
 
82
-    /**
83
-     * Relation to the values
84
-     * 
85
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany $this
86
-     */
87
-    public function values(): HasMany
88
-    {
89
-        return $this->hasMany('Ronmrcdo\Inventory\Models\AttributeValue', 'product_attribute_id');
90
-    }
82
+	/**
83
+	 * Relation to the values
84
+	 * 
85
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany $this
86
+	 */
87
+	public function values(): HasMany
88
+	{
89
+		return $this->hasMany('Ronmrcdo\Inventory\Models\AttributeValue', 'product_attribute_id');
90
+	}
91 91
 }
Please login to merge, or discard this patch.
src/Models/AttributeValue.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -8,55 +8,55 @@
 block discarded – undo
8 8
 
9 9
 class AttributeValue extends Model
10 10
 {
11
-    /**
12
-     * Table name of the attribute values
13
-     * 
14
-     * @var string
15
-     */
16
-    protected $table = 'product_attribute_values';
17
-
18
-    /**
19
-     * Disable the timestamp on model creation
20
-     * 
21
-     * @var bool
22
-     */
23
-    public $timestamps = false;
24
-
25
-    /**
26
-     * Fields that are mass assignable 
27
-     * 
28
-     * @var array
29
-     */
30
-    protected $fillable = [
31
-        'product_attribute_id', 'value'
32
-    ];
33
-
34
-    /**
35
-     * Fields that can't be assigned
36
-     * 
37
-     * @var array
38
-     */
39
-    protected $guarded = [
40
-        'id'
41
-    ];
42
-
43
-    /**
44
-     * Product Relationship
45
-     * 
46
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo $this
47
-     */
48
-    public function attribute(): BelongsTo
49
-    {
50
-        return $this->belongsTo('Ronmrcdo\Inventory\Models\Attribute', 'product_attribute_id');
51
-    }
52
-
53
-    /**
54
-     * Relation of the attribute option to the variant
55
-     * 
56
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany $this
57
-     */
58
-    public function variations(): HasMany
59
-    {
60
-        return $this->hasMany('Ronmrcdo\Inventory\Models\ProductVariant');
61
-    }
11
+	/**
12
+	 * Table name of the attribute values
13
+	 * 
14
+	 * @var string
15
+	 */
16
+	protected $table = 'product_attribute_values';
17
+
18
+	/**
19
+	 * Disable the timestamp on model creation
20
+	 * 
21
+	 * @var bool
22
+	 */
23
+	public $timestamps = false;
24
+
25
+	/**
26
+	 * Fields that are mass assignable 
27
+	 * 
28
+	 * @var array
29
+	 */
30
+	protected $fillable = [
31
+		'product_attribute_id', 'value'
32
+	];
33
+
34
+	/**
35
+	 * Fields that can't be assigned
36
+	 * 
37
+	 * @var array
38
+	 */
39
+	protected $guarded = [
40
+		'id'
41
+	];
42
+
43
+	/**
44
+	 * Product Relationship
45
+	 * 
46
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo $this
47
+	 */
48
+	public function attribute(): BelongsTo
49
+	{
50
+		return $this->belongsTo('Ronmrcdo\Inventory\Models\Attribute', 'product_attribute_id');
51
+	}
52
+
53
+	/**
54
+	 * Relation of the attribute option to the variant
55
+	 * 
56
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany $this
57
+	 */
58
+	public function variations(): HasMany
59
+	{
60
+		return $this->hasMany('Ronmrcdo\Inventory\Models\ProductVariant');
61
+	}
62 62
 }
Please login to merge, or discard this patch.
src/Models/InventoryStockMovement.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@
 block discarded – undo
8 8
 
9 9
 class InventoryStockMovement extends Model
10 10
 {
11
-    use HasItemMovements;
11
+	use HasItemMovements;
12 12
 
13
-    /**
14
-     * Table name
15
-     * 
16
-     * @var string
17
-     */
18
-    protected $table = 'inventory_stock_movements';
13
+	/**
14
+	 * Table name
15
+	 * 
16
+	 * @var string
17
+	 */
18
+	protected $table = 'inventory_stock_movements';
19 19
 
20
-    /**
21
-     * Fields that can be mass assigned
22
-     * 
23
-     * @var arary
24
-     */
25
-    protected $fillable = [
26
-        'stock_id', 'before', 'after', 'cost',
27
-        'reason'
28
-    ];
20
+	/**
21
+	 * Fields that can be mass assigned
22
+	 * 
23
+	 * @var arary
24
+	 */
25
+	protected $fillable = [
26
+		'stock_id', 'before', 'after', 'cost',
27
+		'reason'
28
+	];
29 29
 
30
-    /**
31
-     * Guarded fields that can't be mass assign
32
-     * 
33
-     * @var array
34
-     */
35
-    protected $guarded = [
36
-        'id', 'created_at', 'updated_at'
37
-    ];
30
+	/**
31
+	 * Guarded fields that can't be mass assign
32
+	 * 
33
+	 * @var array
34
+	 */
35
+	protected $guarded = [
36
+		'id', 'created_at', 'updated_at'
37
+	];
38 38
 }
Please login to merge, or discard this patch.
src/Models/Warehouse.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@
 block discarded – undo
7 7
 
8 8
 class Warehouse extends Model
9 9
 {
10
-    /**
11
-     * Table name in database
12
-     * 
13
-     * @var string
14
-     */
15
-    protected $table = 'warehouses';
10
+	/**
11
+	 * Table name in database
12
+	 * 
13
+	 * @var string
14
+	 */
15
+	protected $table = 'warehouses';
16 16
 
17
-    /**
18
-     * Fields that are mass assignable
19
-     * 
20
-     * @var array
21
-     */
22
-    protected $fillable = [
23
-        'name', 'description'
24
-    ];
17
+	/**
18
+	 * Fields that are mass assignable
19
+	 * 
20
+	 * @var array
21
+	 */
22
+	protected $fillable = [
23
+		'name', 'description'
24
+	];
25 25
 
26
-    /**
27
-     * Guarded fields
28
-     * 
29
-     * @var array
30
-     */
31
-    protected $guarded = [
32
-        'id', 'created_at', 'updated_at'
33
-    ];
26
+	/**
27
+	 * Guarded fields
28
+	 * 
29
+	 * @var array
30
+	 */
31
+	protected $guarded = [
32
+		'id', 'created_at', 'updated_at'
33
+	];
34 34
 
35
-    /**
36
-     * Warehouse has many Items
37
-     * 
38
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
39
-     */
40
-    public function items(): HasMany
41
-    {
42
-        return $this->hasMany('Ronmrcdo\Inventory\Models\InventoryStock');
43
-    }
35
+	/**
36
+	 * Warehouse has many Items
37
+	 * 
38
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
39
+	 */
40
+	public function items(): HasMany
41
+	{
42
+		return $this->hasMany('Ronmrcdo\Inventory\Models\InventoryStock');
43
+	}
44 44
 }
Please login to merge, or discard this patch.