generate factories from models
This commit is contained in:
parent
b600a890aa
commit
254a14a3f8
60 changed files with 1507 additions and 140 deletions
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Casts;
|
||||
|
||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class JsonCast implements CastsAttributes
|
||||
{
|
||||
/**
|
||||
* Cast the given value.
|
||||
*
|
||||
* @param array<string, mixed> $attributes
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function get(Model $model, string $key, mixed $value, array $attributes): array
|
||||
{
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the given value for storage.
|
||||
*
|
||||
* @param array<string, mixed> $attributes
|
||||
*/
|
||||
public function set(Model $model, string $key, mixed $value, array $attributes): string
|
||||
{
|
||||
return json_encode($value);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums\Ingredients;
|
||||
namespace App\Enums;
|
||||
|
||||
enum KeywordCategoryEnum : string {
|
||||
case ingredientPleasure = "ingredient_pleasure";
|
||||
case ingredientPracticality = "ingredient_practicality";
|
||||
case ingredientHealth = "ingredient_health";
|
||||
case ingredienEthics = "ingredient_ethics";
|
||||
case productPleasure = "product_pleasure";
|
||||
case productShape = "product_shape";
|
||||
case productPracticality = "product_practicality";
|
||||
|
|
@ -25,14 +26,15 @@ enum KeywordCategoryEnum : string {
|
|||
self::ingredientPleasure => __('IngredientPleasure'),
|
||||
self::ingredientPracticality => __('IngredientPracticality'),
|
||||
self::ingredientHealth => __('IngredientHealth'),
|
||||
self::ingredienEthics => __('IngredientEthics'),
|
||||
self::productPleasure => __('ProductPleasure'),
|
||||
self::productShape => __('ProductShape'),
|
||||
self::productPracticality => __('ProductPracticality'),
|
||||
self::productHealth => __('ProductHealth'),
|
||||
self::productEthics => __('productEthics'),
|
||||
self::packagingPleasure => __('packagingPleasure'),
|
||||
self::packagingPracticality => __('packagingPracticality'),
|
||||
self::packagingEthics => __('packagingEthics'),
|
||||
self::productEthics => __('ProductEthics'),
|
||||
self::packagingPleasure => __('PackagingPleasure'),
|
||||
self::packagingPracticality => __('PackagingPracticality'),
|
||||
self::packagingEthics => __('PackagingEthics'),
|
||||
self::packagingDesign => __('PackagingDesign'),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ enum ProcessPrimaryPackingEnum : int {
|
|||
|
||||
public static function getLabel(self $value): string {
|
||||
return match ($value) {
|
||||
self::sealing => __('Sealing'),
|
||||
self::sealing => __('Operculage'),
|
||||
self::thermoforming => __('Thermoformage'),
|
||||
self::verticalBagging => __('Ensachage Vertical'),
|
||||
self::horizontalBagging => __('Ensachage Horizontal'),
|
||||
|
|
|
|||
48
app/Enums/Process/ProcessTypeEnum.php
Normal file
48
app/Enums/Process/ProcessTypeEnum.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums\Process;
|
||||
|
||||
enum ProcessTypeEnum : int {
|
||||
case slaughter = 1;
|
||||
case beef = 2;
|
||||
case slicing = 3;
|
||||
case cook = 4;
|
||||
case freezing = 5;
|
||||
case forming = 6;
|
||||
case mainPackaging = 7;
|
||||
case secondPackaging = 8;
|
||||
case calibring = 9;
|
||||
case inspection = 10;
|
||||
case identification = 11;
|
||||
case labeling = 12;
|
||||
case conveyance = 13;
|
||||
case logistics = 14;
|
||||
case robotization = 15;
|
||||
case others = 16;
|
||||
|
||||
public function label(): string {
|
||||
return static::getLabel($this);
|
||||
}
|
||||
|
||||
public static function getLabel(self $value): string {
|
||||
return match ($value) {
|
||||
self::slaughter => __('Abbattage/Découpe'),
|
||||
self::beef => __('Préparation de viande'),
|
||||
self::slicing => __('Tranchage/Émincage'),
|
||||
self::cook => __('Cuisson'),
|
||||
self::freezing => __('Refroidissement/Surgélation'),
|
||||
self::forming => __('Formage/Embossage/Portionnage'),
|
||||
self::mainPackaging => __('Conditionnement primaire'),
|
||||
self::secondPackaging => __('Conditionnement secondaire'),
|
||||
self::calibring => __('Pesage/Calibrage'),
|
||||
self::inspection => __('Contrôles/Inspection'),
|
||||
self::identification => __('Identification (Marqueurs/Jets d\'encres)'),
|
||||
self::labeling => __('Étiquetage'),
|
||||
self::conveyance => __('Convoyage/Transitique'),
|
||||
self::logistics => __('Logistiques'),
|
||||
self::robotization => __('Robotisation'),
|
||||
self::others => __('Autres')
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -26,5 +26,4 @@ enum ProductSourceEnum : int {
|
|||
self::catalogArgumentary => __('Catalogue Argumentaire'),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums\Promotions;
|
||||
|
||||
enum PromotionLabelEnum : int {
|
||||
case animation = 1;
|
||||
case reduction = 2;
|
||||
case fidelity = 3;
|
||||
case consoGames = 4;
|
||||
case promotionalFormats = 5;
|
||||
case flyer = 6;
|
||||
case coBranding = 7;
|
||||
case perchandising = 8;
|
||||
case goodies = 9;
|
||||
case promotionalMaterials = 10;
|
||||
case ephemeralProducts = 11;
|
||||
|
||||
public function label(): string {
|
||||
return static::getLabel($this);
|
||||
}
|
||||
|
||||
public static function getLabel(self $value): string {
|
||||
return match ($value) {
|
||||
self::animation => __('Animation'),
|
||||
self::reduction => __('Réduction'),
|
||||
self::fidelity => __('Fidélité'),
|
||||
self::consoGames => __('Jeux Conso'),
|
||||
self::promotionalFormats => __('Formats promo'),
|
||||
self::flyer => __('OP Trade / Prospectus'),
|
||||
self::coBranding => __('Co-branding'),
|
||||
self::perchandising => __('PLV / Merchandising'),
|
||||
self::goodies => __('Primes / Goodies'),
|
||||
self::promotionalMaterials => __('Argumentaires Promo'),
|
||||
self::ephemeralProducts => __('Produits éphèmères'),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ enum PromotionTypeEnum : int {
|
|||
case promotionalFormats = 5;
|
||||
case flyer = 6;
|
||||
case coBranding = 7;
|
||||
case perchandising = 8;
|
||||
case merchandising = 8;
|
||||
case goodies = 9;
|
||||
case promotionalMaterials = 10;
|
||||
case ephemeralProducts = 11;
|
||||
|
|
@ -28,7 +28,7 @@ enum PromotionTypeEnum : int {
|
|||
self::promotionalFormats => __('Formats promo'),
|
||||
self::flyer => __('OP Trade / Prospectus'),
|
||||
self::coBranding => __('Co-branding'),
|
||||
self::perchandising => __('PLV / Merchandising'),
|
||||
self::merchandising => __('PLV / Merchandising'),
|
||||
self::goodies => __('Primes / Goodies'),
|
||||
self::promotionalMaterials => __('Argumentaires Promo'),
|
||||
self::ephemeralProducts => __('Produits éphèmères'),
|
||||
|
|
|
|||
|
|
@ -2,29 +2,54 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id
|
||||
* @property string $brand
|
||||
* @property string $filter
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property Promo[] $promos
|
||||
* @property Promo[] $promo
|
||||
* @property Product[] $products
|
||||
*/
|
||||
class Brand extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'brand',
|
||||
'filter'
|
||||
'filter',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function promos()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Promo', 'promo_brands');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function promos()
|
||||
public function promo()
|
||||
{
|
||||
return $this->hasMany('App\Models\Promo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany('App\Models\Product');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\JsonCast;
|
||||
use App\Enums\Ingredients\IngredientOriginEnum;
|
||||
use App\Enums\Ingredients\IngredientFamilyEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -29,6 +29,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Ingredient extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -60,9 +62,9 @@ class Ingredient extends Model
|
|||
'origin' => IngredientOriginEnum::class,
|
||||
'is_sample' => 'boolean',
|
||||
'family' => IngredientFamilyEnum::class,
|
||||
'packing' => JsonCast::class,
|
||||
'function' => JsonCast::class,
|
||||
'documents' => JsonCast::class,
|
||||
'packing' => 'json',
|
||||
'function' => 'json',
|
||||
'documents' => 'json',
|
||||
'created_at' => 'datetime:Y-m-d',
|
||||
'updated_at' => 'datetime:Y-m-d',
|
||||
'deleted_at' => 'datetime:Y-m-d',
|
||||
|
|
|
|||
|
|
@ -2,19 +2,22 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id
|
||||
* @property integer $keyword_id
|
||||
* @property string $model
|
||||
* @property integer $keywordable_id
|
||||
* @property string $model
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property Keyword $keyword
|
||||
*/
|
||||
class Keywordable extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Enums\Packaging\PackagingWatchTypeEnum;
|
|||
use App\Enums\Packaging\PackagingTypeEnum;
|
||||
use App\Enums\Packaging\PackagingMaterialEnum;
|
||||
use App\Enums\Packaging\PackagingBenefitEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -33,6 +34,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Packaging extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -69,8 +72,8 @@ class Packaging extends Model
|
|||
'type_packaging' => PackagingTypeEnum::class,
|
||||
'material' => PackagingMaterialEnum::class,
|
||||
'benefit' => PackagingBenefitEnum::class,
|
||||
'picture' => JsonCast::class,
|
||||
'documents' => JsonCast::class,
|
||||
'picture' => 'json',
|
||||
'documents' => 'json',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Models;
|
|||
use App\Enums\Process\ProcessWatchTypeEnum;
|
||||
use App\Enums\Process\ProcessOriginEnum;
|
||||
use App\Enums\Process\ProcessBenefitEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +32,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Process extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -65,8 +68,8 @@ class Process extends Model
|
|||
'is_test_machine' => 'boolean',
|
||||
'is_quotation' => 'boolean',
|
||||
'profit' => ProcessBenefitEnum::class,
|
||||
'picture' => JsonCast::class,
|
||||
'documents' => JsonCast::class,
|
||||
'picture' => 'json',
|
||||
'documents' => 'json',
|
||||
'created_at' => 'datetime:Y-m-d',
|
||||
'updated_at' => 'datetime:Y-m-d',
|
||||
'deleted_at' => 'datetime:Y-m-d',
|
||||
|
|
@ -77,7 +80,7 @@ class Process extends Model
|
|||
*/
|
||||
public function processHasProcessTypes()
|
||||
{
|
||||
return $this->hasMany('App\Models\ProcessHasProcessType');
|
||||
return $this->hasMany('App\Models\ProcessHasProcessType', 'process_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
52
app/Models/ProcessHasProcessType.php
Normal file
52
app/Models/ProcessHasProcessType.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property integer $process_id
|
||||
* @property integer $process_type_id
|
||||
* @property string $value_enum
|
||||
* @property ProcessType $processType
|
||||
* @property Process $process
|
||||
*/
|
||||
class ProcessHasProcessType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'process_id',
|
||||
'process_type_id',
|
||||
'value_enum'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'value_enum' => 'json'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function processType()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ProcessType');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Process');
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
/**
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property ProcessHasProcessType[] $processHasProcessTypes
|
||||
*/
|
||||
class ProcessType extends Model
|
||||
|
|
@ -15,7 +17,9 @@ class ProcessType extends Model
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name'
|
||||
'name',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -23,6 +27,6 @@ class ProcessType extends Model
|
|||
*/
|
||||
public function processHasProcessTypes()
|
||||
{
|
||||
return $this->hasMany('App\Models\ProcessHasProcessType');
|
||||
return $this->hasMany('App\Models\ProcessHasProcessType', 'process_type_id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use App\Enums\Products\ProductRayEnum;
|
|||
use App\Enums\Products\ProductRangeEnum;
|
||||
use App\Enums\Products\ProductGeoAreaEnum;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
/**
|
||||
* @property integer $id
|
||||
|
|
@ -46,6 +47,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -88,10 +91,10 @@ class Product extends Model
|
|||
*/
|
||||
protected $casts = [
|
||||
'source' => ProductSourceEnum::class,
|
||||
'docs' => JsonCast::class,
|
||||
'docs' => 'json',
|
||||
'certification' => ProductCertificationEnum::class,
|
||||
'origins' => JsonCast::class,
|
||||
'claims' => JsonCast::class,
|
||||
'origins' => 'json',
|
||||
'claims' => 'json',
|
||||
'distribution_network' => ProductDistributionNetworkEnum::class,
|
||||
'ray' => ProductRayEnum::class,
|
||||
'product_range' => ProductRangeEnum::class,
|
||||
|
|
@ -118,4 +121,12 @@ class Product extends Model
|
|||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function brand()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Brand');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -18,6 +19,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class ProductComment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Enums\Promotions\PromotionSourceEnum;
|
|||
use App\Enums\Promotions\PromotionTargetEnum;
|
||||
use App\Enums\Promotions\PromotionAngleEnum;
|
||||
use App\Enums\Promotions\PromotionEventEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -33,9 +34,12 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property PromoType $promoType
|
||||
* @property PromoDistributionNetwork $promoDistributionNetwork
|
||||
* @property User $user
|
||||
* @property Brand $brand
|
||||
*/
|
||||
class Promo extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -77,6 +81,14 @@ class Promo extends Model
|
|||
'deleted_at' => 'datetime:Y-m-d',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function brands()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Brand', 'promo_brands');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Enums\Promotions\PromotionDistributionNetworkEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -15,6 +16,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class PromoDistributionNetwork extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Enums\Promotions\PromotionTypeEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -15,6 +16,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class PromoType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* Indicates if the IDs are auto-incrementing.
|
||||
*
|
||||
|
|
@ -26,7 +29,7 @@ class PromoType extends Model
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'value',
|
||||
'label',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
|
|
@ -38,7 +41,7 @@ class PromoType extends Model
|
|||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'name' => PromotionTypeEnum::class
|
||||
'value' => PromotionTypeEnum::class
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Surveys\SurveyCustomerEnum;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -22,6 +24,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Survey extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -47,9 +51,10 @@ class Survey extends Model
|
|||
*/
|
||||
protected $casts = [
|
||||
'date' => 'datetime:Y-m-d',
|
||||
'documents' => JsonCast::class,
|
||||
'documents' => 'json',
|
||||
'is_distributor' => 'boolean',
|
||||
'is_customer' => 'boolean',
|
||||
'type' => SurveyCustomerEnum::class,
|
||||
'created_at' => 'datetime:Y-m-d',
|
||||
'updated_at' => 'datetime:Y-m-d',
|
||||
'deleted_at' => 'datetime:Y-m-d',
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory, Notifiable;
|
||||
use HasFactory;
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
|
|
|||
|
|
@ -16,13 +16,14 @@
|
|||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"kitloong/laravel-migrations-generator": "^6.8",
|
||||
"krlove/eloquent-model-generator": "dev-l10-compatibility",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"spatie/laravel-ignition": "^2.0",
|
||||
"krlove/eloquent-model-generator": "dev-l10-compatibility"
|
||||
"thedoctor0/laravel-factory-generator": "^1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
|
|||
64
composer.lock
generated
64
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6b1066153741c0a141964ac76eff452f",
|
||||
"content-hash": "6795aca887705adf5c7324775eff9a2c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
|
|
@ -8298,6 +8298,68 @@
|
|||
],
|
||||
"time": "2023-01-10T18:53:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "thedoctor0/laravel-factory-generator",
|
||||
"version": "1.2.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TheDoctor0/laravel-factory-generator.git",
|
||||
"reference": "cf911ee7dcaf4b6b99dfeb5f77fc0af9501de8e1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/TheDoctor0/laravel-factory-generator/zipball/cf911ee7dcaf4b6b99dfeb5f77fc0af9501de8e1",
|
||||
"reference": "cf911ee7dcaf4b6b99dfeb5f77fc0af9501de8e1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/dbal": "^2.9|^2.10|^3.0",
|
||||
"illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0",
|
||||
"illuminate/filesystem": "^6.0|^7.0|^8.0|^9.0|^10.0",
|
||||
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
|
||||
"php": ">=7.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"TheDoctor0\\LaravelFactoryGenerator\\FactoryGeneratorServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TheDoctor0\\LaravelFactoryGenerator\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Automatically generate Laravel factories for your models.",
|
||||
"keywords": [
|
||||
"factories",
|
||||
"factory",
|
||||
"generator",
|
||||
"laravel",
|
||||
"tests"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/TheDoctor0/laravel-factory-generator/issues",
|
||||
"source": "https://github.com/TheDoctor0/laravel-factory-generator/tree/1.2.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.paypal.me/thedoctor0",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/thedoctor0",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-22T11:34:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
"version": "1.2.1",
|
||||
|
|
|
|||
32
database/factories/BrandFactory.php
Normal file
32
database/factories/BrandFactory.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Brand;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Brand>
|
||||
*/
|
||||
final class BrandFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Brand::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'brand' => fake()->word,
|
||||
'filter' => fake()->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
47
database/factories/IngredientFactory.php
Normal file
47
database/factories/IngredientFactory.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Ingredients\IngredientOriginEnum;
|
||||
use App\Enums\Ingredients\IngredientFamilyEnum;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Ingredient>
|
||||
*/
|
||||
final class IngredientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Ingredient::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => fake()->randomElement(User::pluck('id')),
|
||||
'name' => fake()->word,
|
||||
'supplier' => fake()->word,
|
||||
'origin' => \collect(IngredientOriginEnum::cases())->random(),
|
||||
'is_sample' => fake()->boolean,
|
||||
'family' => \collect(IngredientFamilyEnum::cases())->random(),
|
||||
'packing' => fake()->word,
|
||||
'function' => fake()->word,
|
||||
'observation' => fake()->word,
|
||||
'picture' => fake()->word,
|
||||
'url' => fake()->url,
|
||||
'documents' => [fake()->word],
|
||||
'fair' => fake()->word,
|
||||
'deleted_at' => fake()->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
33
database/factories/KeywordableFactory.php
Normal file
33
database/factories/KeywordableFactory.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Keyword;
|
||||
use App\Models\Keywordable;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Keywordable>
|
||||
*/
|
||||
final class KeywordableFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Keywordable::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'keyword_id' => fake()->randomElement(Keyword::pluck('id')),
|
||||
'keywordable_id' => fake()->randomNumber()
|
||||
];
|
||||
}
|
||||
}
|
||||
52
database/factories/PackagingFactory.php
Normal file
52
database/factories/PackagingFactory.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Packaging\PackagingOriginEnum;
|
||||
use App\Enums\Packaging\PackagingWatchTypeEnum;
|
||||
use App\Enums\Packaging\PackagingTypeEnum;
|
||||
use App\Enums\Packaging\PackagingMaterialEnum;
|
||||
use App\Enums\Packaging\PackagingBenefitEnum;
|
||||
use App\Models\Packaging;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Packaging>
|
||||
*/
|
||||
final class PackagingFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Packaging::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => fake()->randomElement(User::pluck('id')),
|
||||
'watch_type' => \collect(PackagingWatchTypeEnum::cases())->random(),
|
||||
'supplier' => fake()->word,
|
||||
'name' => fake()->name,
|
||||
'product_description' => fake()->word,
|
||||
'origin' => \collect(PackagingOriginEnum::cases())->random(),
|
||||
'is_sample' => fake()->boolean,
|
||||
'type_packaging' => \collect(PackagingTypeEnum::cases())->random(),
|
||||
'material' => \collect(PackagingMaterialEnum::cases())->random(),
|
||||
'benefit' => \collect(PackagingBenefitEnum::cases())->random(),
|
||||
'observation' => fake()->word,
|
||||
'picture' => [fake()->word],
|
||||
'url' => fake()->url,
|
||||
'documents' => [fake()->word],
|
||||
'fair' => fake()->word,
|
||||
'deleted_at' => fake()->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
49
database/factories/ProcessFactory.php
Normal file
49
database/factories/ProcessFactory.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Process\ProcessWatchTypeEnum;
|
||||
use App\Enums\Process\ProcessOriginEnum;
|
||||
use App\Enums\Process\ProcessBenefitEnum;
|
||||
use App\Models\Process;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Process>
|
||||
*/
|
||||
final class ProcessFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Process::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => fake()->randomElement(User::pluck('id')),
|
||||
'watch_type' => \collect(ProcessWatchTypeEnum::cases())->random(),
|
||||
'supplier' => fake()->word,
|
||||
'name' => fake()->name,
|
||||
'description' => fake()->text,
|
||||
'origin' => \collect(ProcessOriginEnum::cases())->random(),
|
||||
'is_test_machine' => fake()->boolean,
|
||||
'is_quotation' => fake()->boolean,
|
||||
'quotation_document' => fake()->word,
|
||||
'profit' => \collect(ProcessBenefitEnum::cases())->random(),
|
||||
'observation' => fake()->word,
|
||||
'picture' => [fake()->word],
|
||||
'documents' => [fake()->word],
|
||||
'url' => fake()->url,
|
||||
'deleted_at' => fake()->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
34
database/factories/ProcessHasProcessTypeFactory.php
Normal file
34
database/factories/ProcessHasProcessTypeFactory.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Process;
|
||||
use App\Models\ProcessHasProcessType;
|
||||
use App\Models\ProcessType;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\ProcessHasProcessType>
|
||||
*/
|
||||
final class ProcessHasProcessTypeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = ProcessHasProcessType::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'process_id' => fake()->randomElement(Process::pluck('id')),
|
||||
'process_type_id' => fake()->randomElement(ProcessType::pluck('id')),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
database/factories/ProductCommentFactory.php
Normal file
37
database/factories/ProductCommentFactory.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductComment;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\ProductComment>
|
||||
*/
|
||||
final class ProductCommentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = ProductComment::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'product_id' => fake()->randomElement(Product::pluck('id')),
|
||||
'evaluation' => fake()->word,
|
||||
'aspect' => fake()->word,
|
||||
'taste' => fake()->word,
|
||||
'odor' => fake()->word,
|
||||
'texture' => fake()->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
64
database/factories/ProductFactory.php
Normal file
64
database/factories/ProductFactory.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Products\ProductSourceEnum;
|
||||
use App\Enums\Products\ProductCertificationEnum;
|
||||
use App\Enums\Products\ProductDistributionNetworkEnum;
|
||||
use App\Enums\Products\ProductRayEnum;
|
||||
use App\Enums\Products\ProductRangeEnum;
|
||||
use App\Enums\Products\ProductGeoAreaEnum;
|
||||
use App\Models\Brand;
|
||||
use App\Models\Product;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Product>
|
||||
*/
|
||||
final class ProductFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Product::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => fake()->randomElement(User::pluck('id')),
|
||||
'brand_id' => fake()->randomElement(Brand::pluck('id')),
|
||||
'name' => fake()->word,
|
||||
'entry_date' => fake()->dateTime(),
|
||||
'source' => \collect(ProductSourceEnum::cases())->random(),
|
||||
'fair' => fake()->word,
|
||||
'shop' => fake()->word,
|
||||
'catalogue' => fake()->word,
|
||||
'gencod' => fake()->word,
|
||||
'picture' => fake()->word,
|
||||
'docs' => fake()->text,
|
||||
'url' => fake()->url,
|
||||
'certification' => \collect(ProductCertificationEnum::cases())->random(),
|
||||
'origins' => fake()->word,
|
||||
'claims' => fake()->word,
|
||||
'specified_claim' => fake()->word,
|
||||
'distribution_network' => \collect(ProductDistributionNetworkEnum::cases())->random(),
|
||||
'ray' => \collect(ProductRayEnum::cases())->random(),
|
||||
'product_range' => \collect(ProductRangeEnum::cases())->random(),
|
||||
'geo_area' => \collect(ProductGeoAreaEnum::cases())->random(),
|
||||
'weight' => fake()->randomNumber(),
|
||||
'pvc' => fake()->randomNumber(),
|
||||
'comment' => fake()->word,
|
||||
'is_tasted' => fake()->boolean,
|
||||
'tasters_number' => fake()->numberBetween(0, 15),
|
||||
'deleted_at' => fake()->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
33
database/factories/PromoDistributionNetworkFactory.php
Normal file
33
database/factories/PromoDistributionNetworkFactory.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Promotions\PromotionDistributionNetworkEnum;
|
||||
use App\Models\PromoDistributionNetwork;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\PromoDistributionNetwork>
|
||||
*/
|
||||
final class PromoDistributionNetworkFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = PromoDistributionNetwork::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => \collect(PromotionDistributionNetworkEnum::cases())->random(),
|
||||
'label' => fake()->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
55
database/factories/PromoFactory.php
Normal file
55
database/factories/PromoFactory.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Promotions\PromotionSourceEnum;
|
||||
use App\Enums\Promotions\PromotionTargetEnum;
|
||||
use App\Enums\Promotions\PromotionAngleEnum;
|
||||
use App\Enums\Promotions\PromotionEventEnum;
|
||||
use App\Models\Brand;
|
||||
use App\Models\Promo;
|
||||
use App\Models\PromoDistributionNetwork;
|
||||
use App\Models\PromoType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Promo>
|
||||
*/
|
||||
final class PromoFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Promo::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => fake()->randomElement(User::pluck('id')),
|
||||
'promo_type_id' => fake()->randomElement(PromoType::pluck('id')),
|
||||
'promo_distribution_network_id' => fake()->randomElement(PromoDistributionNetwork::pluck('id')),
|
||||
'brand_id' => fake()->randomElement(Brand::pluck('id')),
|
||||
'date' => fake()->dateTime(),
|
||||
'source' => \collect(PromotionSourceEnum::cases())->random(),
|
||||
'shop_name' => fake()->word,
|
||||
'shop_city' => fake()->word,
|
||||
'sector_chief' => fake()->word,
|
||||
'name' => fake()->word,
|
||||
'target' => \collect(PromotionTargetEnum::cases())->random(),
|
||||
'angle' => \collect(PromotionAngleEnum::cases())->random(),
|
||||
'event' => \collect(PromotionEventEnum::cases())->random(),
|
||||
'url' => fake()->url,
|
||||
'press' => fake()->word,
|
||||
'fair' => fake()->word,
|
||||
'deleted_at' => fake()->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
41
database/factories/SurveyFactory.php
Normal file
41
database/factories/SurveyFactory.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Survey;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Survey>
|
||||
*/
|
||||
final class SurveyFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Survey::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$is = fake()->boolean;
|
||||
return [
|
||||
'user_id' => fake()->randomElement(User::pluck('id')),
|
||||
'name' => fake()->word,
|
||||
'author' => fake()->word,
|
||||
'comment' => fake()->word,
|
||||
'date' => fake()->dateTime(),
|
||||
'documents' => [fake()->word],
|
||||
'is_distributor' => ($is) ? 1 : 0,
|
||||
'is_customer' => (!$is) ? 1 : 0,
|
||||
'deleted_at' => fake()->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,39 +2,31 @@
|
|||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
* @extends Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
final class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
'firstname' => fake()->firstName,
|
||||
'lastname' => fake()->lastName,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ return new class extends Migration
|
|||
$table->bigInteger('id', true);
|
||||
$table->string('brand')->comment('Nom de la marque, auto suggestion sur la table brand');
|
||||
$table->string('filter')->nullable()->comment('Champ pour gérer le filtrage des marques dans les différents select de l\'application');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ return new class extends Migration
|
|||
$table->text('observation')->nullable()->comment('Observations - texte libre');
|
||||
$table->string('picture')->nullable()->comment('Image de l\'ingrédient - 1 path de visuel de référence - 1 doc JPG ou JPEG (recommandé) - redimenssioner 1200x900');
|
||||
$table->string('url')->nullable()->comment('url nullable - si not null:validation URL');
|
||||
$table->text('documents')->nullable()->comment('Doc complémentaires (Annexes) - Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs ');
|
||||
$table->json('documents')->nullable()->comment('Doc complémentaires (Annexes) - Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs ');
|
||||
$table->string('fair')->nullable()->comment('not null si origin (InformationOriginEnum) == salon');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ return new class extends Migration
|
|||
$table->comment('');
|
||||
$table->bigInteger('id', true);
|
||||
$table->string('label')->comment('unique with keyword_cat');
|
||||
$table->string('keyword_cat')->comment(' unique with label (valeur de l\'enum KeywordCategoryEnum)');
|
||||
$table->string('keyword_cat')->comment('unique with label (valeur de l\'enum KeywordCategoryEnum)');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['label', 'keyword_cat']);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ return new class extends Migration
|
|||
$table->text('observation')->nullable()->comment('Texte libre - nullable');
|
||||
$table->string('picture')->nullable()->comment('Image - 1 path du visuel de référence - Redimensioner 1200x900');
|
||||
$table->string('url')->nullable()->comment('url nullable - si not null: valider url avec une validation laravel');
|
||||
$table->text('documents')->nullable()->comment('Documents - Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs (recommandé)');
|
||||
$table->json('documents')->nullable()->comment('Documents - Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs (recommandé)');
|
||||
$table->string('fair')->nullable()->comment('not null si origin (valeur de l\'enum InformationOriginEnum) == salon');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ return new class extends Migration
|
|||
$table->comment('');
|
||||
$table->bigInteger('process_id')->index();
|
||||
$table->bigInteger('process_type_id')->index();
|
||||
$table->string('value_enum')->comment('Not Null si process_type = "Préparation Viande": Tableau de INT contenant les valeurs de MeatPreparationEnum - Not Null si process_type = "Conditionnement primaire": Tableau de INT contenant les valeurs de PrimaryPackingEnum');
|
||||
$table->string('value_enum')->nullable()->comment('Not Null si process_type = "Préparation Viande": Tableau de INT contenant les valeurs de MeatPreparationEnum - Not Null si process_type = "Conditionnement primaire": Tableau de INT contenant les valeurs de PrimaryPackingEnum');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ return new class extends Migration
|
|||
$table->comment('');
|
||||
$table->bigInteger('id', true);
|
||||
$table->string('name')->comment('sur le front cela correspond au select "Type de process"');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ return new class extends Migration
|
|||
$table->string('quotation_document')->nullable()->comment('Devis - Nullable si `is_quotation` = 0 - Not null si `is_quotation`= 1: 1 doc - 1 path à stocker en string');
|
||||
$table->unsignedTinyInteger('profit')->comment('Benefice - Required (valeur de l\'enum BenefitEnum)');
|
||||
$table->text('observation')->nullable()->comment('observations - nullable');
|
||||
$table->text('picture')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés (visuels de référence) - 0 a 5 docs JPG ou JPEG (recommandé) - Redimenssioner 1200x900 (h)');
|
||||
$table->text('documents')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs (recommandé)');
|
||||
$table->json('picture')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés (visuels de référence) - 0 a 5 docs JPG ou JPEG (recommandé) - Redimenssioner 1200x900 (h)');
|
||||
$table->json('documents')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs (recommandé)');
|
||||
$table->string('url')->nullable()->comment('url nullable - si not null: valider url avec une validation laravel');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('promo_brands', function (Blueprint $table) {
|
||||
$table->comment('');
|
||||
$table->bigInteger('promo_id')->index();
|
||||
$table->bigInteger('brand_id')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('promo_brands');
|
||||
}
|
||||
};
|
||||
|
|
@ -16,7 +16,7 @@ return new class extends Migration
|
|||
Schema::create('promo_types', function (Blueprint $table) {
|
||||
$table->comment('');
|
||||
$table->bigInteger('id')->primary();
|
||||
$table->tinyInteger('name')->comment('Required - Niveau 1 - (valeur de l\'enum TypePromoEnum) - Seeder niveau 2: champ label (valeur de l\'enum LabelTypePromoEnum)');
|
||||
$table->tinyInteger('value')->comment('Required - Niveau 1 - (valeur de l\'enum TypePromoEnum) - Seeder niveau 2: champ label (valeur de l\'enum LabelTypePromoEnum)');
|
||||
$table->string('label')->comment('Seedé dans l\'application en fonction de name');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('promo_brands', function (Blueprint $table) {
|
||||
$table->foreign(['promo_id'])->references(['id'])->on('promos');
|
||||
$table->foreign(['brand_id'])->references(['id'])->on('brands');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('promo_brands', function (Blueprint $table) {
|
||||
$table->dropForeign('promos_promo_id_foreign');
|
||||
$table->dropForeign('promos_brand_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
19
database/seeders/BrandSeeder.php
Normal file
19
database/seeders/BrandSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Brand;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BrandSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Brand::factory(10)->create();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,21 +2,32 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run(): void
|
||||
public function run()
|
||||
{
|
||||
// \App\Models\User::factory(10)->create();
|
||||
|
||||
// \App\Models\User::factory()->create([
|
||||
// 'name' => 'Test User',
|
||||
// 'email' => 'test@example.com',
|
||||
// ]);
|
||||
$this->call([
|
||||
UserSeeder::class,
|
||||
KeywordSeeder::class,
|
||||
BrandSeeder::class,
|
||||
IngredientSeeder::class,
|
||||
PackagingSeeder::class,
|
||||
ProcessSeeder::class,
|
||||
ProcessTypeSeeder::class,
|
||||
ProcessHasProcessTypes::class,
|
||||
ProductSeeder::class,
|
||||
ProductCommentSeeder::class,
|
||||
PromoDistributionNetworkSeeder::class,
|
||||
PromoTypeSeeder::class,
|
||||
PromoSeeder::class,
|
||||
SurveySeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
19
database/seeders/IngredientSeeder.php
Normal file
19
database/seeders/IngredientSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Ingredient;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class IngredientSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Ingredient::factory(25)->create();
|
||||
}
|
||||
}
|
||||
233
database/seeders/KeywordSeeder.php
Normal file
233
database/seeders/KeywordSeeder.php
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\KeywordCategoryEnum;
|
||||
use App\Models\Keyword;
|
||||
use App\Models\Keywordable;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class KeywordSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$id = 0;
|
||||
/**
|
||||
* * INGREDIENTS
|
||||
*/
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[0];
|
||||
$keyword->label = "Sophistication";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[0];
|
||||
$keyword->label = "Exotisme";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[0];
|
||||
$keyword->label = "Fun";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[1];
|
||||
$keyword->label = "Clean label/naturalité";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[1];
|
||||
$keyword->label = "Végétarien/vegan";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[1];
|
||||
$keyword->label = "Bien être";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[2];
|
||||
$keyword->label = "Solidarité";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[2];
|
||||
$keyword->label = "Écologie";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[3];
|
||||
$keyword->label = "Emballage individuel";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[3];
|
||||
$keyword->label = "Facilité de mise en oeuvre";
|
||||
$keyword->save();
|
||||
|
||||
/**
|
||||
* * PRODUCTS
|
||||
*/
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[4];
|
||||
$keyword->label = "Sophistication";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[4];
|
||||
$keyword->label = "Exotisme";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[4];
|
||||
$keyword->label = "Variété des sens";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[4];
|
||||
$keyword->label = "Fun";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[5];
|
||||
$keyword->label = "Minceur";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[5];
|
||||
$keyword->label = "Énergie/Bien-être";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[5];
|
||||
$keyword->label = "Cosmétique";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[6];
|
||||
$keyword->label = "Manipulation produit";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[6];
|
||||
$keyword->label = "Gain de temps";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[6];
|
||||
$keyword->label = "Nomadisme";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[7];
|
||||
$keyword->label = "Naturalité";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[7];
|
||||
$keyword->label = "Végétal";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[7];
|
||||
$keyword->label = "Médical";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[8];
|
||||
$keyword->label = "Solidarité";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[8];
|
||||
$keyword->label = "Écologie";
|
||||
$keyword->save();
|
||||
|
||||
/**
|
||||
* * PACKAGING
|
||||
*/
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[9];
|
||||
$keyword->label = "Sophistication";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[9];
|
||||
$keyword->label = "Exotisme";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[9];
|
||||
$keyword->label = "Fun";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[10];
|
||||
$keyword->label = "Manipulation produit";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[10];
|
||||
$keyword->label = "Gain de temps";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[10];
|
||||
$keyword->label = "Nomadisme";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[11];
|
||||
$keyword->label = "Décor/forme";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[11];
|
||||
$keyword->label = "Matériaux";
|
||||
$keyword->save();
|
||||
|
||||
$keyword = new Keyword();
|
||||
$keyword->keyword_cat = \collect(KeywordCategoryEnum::cases())[12];
|
||||
$keyword->label = "Écologie";
|
||||
$keyword->save();
|
||||
|
||||
// Seeder for keywordables table.
|
||||
Keyword::query()->get()->each(function (Keyword $keyword) {
|
||||
Keywordable::factory(mt_rand(1, 3))->make()->each(function (Keywordable $keywordable) use ($keyword) {
|
||||
if (
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[1]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[2]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[3]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[4]->value
|
||||
) {
|
||||
$keywordable->keyword()->associate($keyword);
|
||||
$keywordable->model = 'App\Models\Ingredients';
|
||||
$keywordable->saveOrFail();
|
||||
} elseif (
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[5]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[6]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[7]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[8]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[9]->value
|
||||
) {
|
||||
$keywordable->keyword()->associate($keyword);
|
||||
$keywordable->model = 'App\Models\Products';
|
||||
$keywordable->saveOrFail();
|
||||
} elseif (
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[10]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[11]->value ||
|
||||
$keyword->keyword_cat->value === \collect(KeywordCategoryEnum::cases())[12]->value
|
||||
) {
|
||||
$keywordable->keyword()->associate($keyword);
|
||||
$keywordable->model = 'App\Models\Packaging';
|
||||
$keywordable->saveOrFail();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
19
database/seeders/PackagingSeeder.php
Normal file
19
database/seeders/PackagingSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Packaging;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PackagingSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Packaging::factory(50)->create();
|
||||
}
|
||||
}
|
||||
33
database/seeders/ProcessHasProcessTypes.php
Normal file
33
database/seeders/ProcessHasProcessTypes.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\Process\ProcessTypeEnum;
|
||||
use App\Enums\Process\ProcessMeatPreparationEnum;
|
||||
use App\Enums\Process\ProcessPrimaryPackingEnum;
|
||||
use App\Models\ProcessHasProcessType;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProcessHasProcessTypes extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
ProcessHasProcessType::factory(10)->make()->each(function (ProcessHasProcessType $processHasProcessType) {
|
||||
if ($processHasProcessType->processType->name === ProcessTypeEnum::beef->label()) {
|
||||
$processHasProcessType->value_enum = \collect(ProcessMeatPreparationEnum::cases());
|
||||
$processHasProcessType->saveOrFail();
|
||||
} elseif ($processHasProcessType->processType->name === ProcessTypeEnum::mainPackaging->label()) {
|
||||
$processHasProcessType->value_enum = \collect(ProcessPrimaryPackingEnum::cases());
|
||||
$processHasProcessType->saveOrFail();
|
||||
} else {
|
||||
$processHasProcessType->value_enum = null;
|
||||
$processHasProcessType->saveOrFail();
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
19
database/seeders/ProcessSeeder.php
Normal file
19
database/seeders/ProcessSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Process;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProcessSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Process::factory(50)->create();
|
||||
}
|
||||
}
|
||||
24
database/seeders/ProcessTypeSeeder.php
Normal file
24
database/seeders/ProcessTypeSeeder.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\Process\ProcessTypeEnum;
|
||||
use App\Models\ProcessType;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProcessTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
foreach (\collect(ProcessTypeEnum::cases()) as $key => $value) {
|
||||
$processType = new ProcessType();
|
||||
$processType->name = $value->label();
|
||||
$processType->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
database/seeders/ProductCommentSeeder.php
Normal file
19
database/seeders/ProductCommentSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ProductComment;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductCommentSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
ProductComment::factory(100)->create();
|
||||
}
|
||||
}
|
||||
19
database/seeders/ProductSeeder.php
Normal file
19
database/seeders/ProductSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Product::factory(50)->create();
|
||||
}
|
||||
}
|
||||
19
database/seeders/PromoDistributionNetworkSeeder.php
Normal file
19
database/seeders/PromoDistributionNetworkSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\PromoDistributionNetwork;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PromoDistributionNetworkSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
PromoDistributionNetwork::factory(25)->create();
|
||||
}
|
||||
}
|
||||
32
database/seeders/PromoSeeder.php
Normal file
32
database/seeders/PromoSeeder.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\Promotions\PromotionTypeEnum;
|
||||
use App\Models\Brand;
|
||||
use App\Models\Promo;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PromoSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$countPromo = 25;
|
||||
Promo::factory($countPromo)->create();
|
||||
|
||||
// Seeder for news_product table.
|
||||
$brands = Brand::query()->get();
|
||||
Promo::each(function (Promo $promo) use ($brands, $countPromo) {
|
||||
if ($promo->promotype->value->value === PromotionTypeEnum::coBranding->value) {
|
||||
$offset = rand(1, $countPromo);
|
||||
$length = 1;
|
||||
$promo->brands()->saveMany($brands->slice($offset, $length));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
143
database/seeders/PromoTypeSeeder.php
Normal file
143
database/seeders/PromoTypeSeeder.php
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\Promotions\PromotionTypeEnum;
|
||||
use App\Models\PromoType;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PromoTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$id = 1;
|
||||
|
||||
// * ANIMATION
|
||||
$promotypeAnimation = ['Stand', 'Food truck', 'Galerie marchande', 'Rayon'];
|
||||
foreach ($promotypeAnimation as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::animation->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * REDUCTION
|
||||
$id = $id + count($promotypeAnimation);
|
||||
$promotypeReduction = ['BRI', 'BRD', 'BR croisé', '100% remboursé', 'Autres'];
|
||||
foreach ($promotypeReduction as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::reduction->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * FIDELITY
|
||||
$id = $id + count($promotypeReduction);
|
||||
$promotypeFidelity = ['Programme marque', 'Programme enseigne'];
|
||||
foreach ($promotypeFidelity as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::fidelity->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * CONSOGAMES
|
||||
$id = $id + count($promotypeFidelity);
|
||||
$promotypeConsogames = ['Réseaux sociaux', 'Site web', 'Magasin'];
|
||||
foreach ($promotypeConsogames as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::consoGames->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * PROMOTIONALFORMATS
|
||||
$id = $id + count($promotypeConsogames);
|
||||
$promotypePromotionalformats = ['Lots', 'Gratuit'];
|
||||
foreach ($promotypePromotionalformats as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::promotionalFormats->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * FLYER
|
||||
$id = $id + count($promotypePromotionalformats);
|
||||
$promotypeFlyer = ['Monomarques', 'Multi-marque'];
|
||||
foreach ($promotypeFlyer as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::flyer->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * COBRANDING
|
||||
$id = $id + count($promotypeFlyer);
|
||||
$promotypeCobranding = ['Selectionnez vos marques'];
|
||||
foreach ($promotypeCobranding as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::coBranding->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * MERCHANDISING
|
||||
$id = $id + count($promotypeCobranding);
|
||||
$promotypeMerchandising = ['Démarche merchandising rayon', 'PLV bas-ilôt', 'PLV dédié produit'];
|
||||
foreach ($promotypeMerchandising as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::merchandising->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * GOODIES
|
||||
$id = $id + count($promotypeMerchandising);
|
||||
$promotypeGoodies = ['Objet collector', 'Primes in pack', 'Primes contenant', 'Goodies animation'];
|
||||
foreach ($promotypeGoodies as $key => $label) {
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::goodies->value;
|
||||
$promotype->label = $label;
|
||||
$promotype->save();
|
||||
}
|
||||
|
||||
// * PROMOTIONALMATERIALS
|
||||
$id = $id + count($promotypeGoodies) + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::promotionalMaterials->value;
|
||||
$promotype->label = 'Pas de niveau 2';
|
||||
$promotype->save();
|
||||
|
||||
// * EPHEMERALPRODUCTS
|
||||
$id = $id + $key;
|
||||
$promotype = new PromoType();
|
||||
$promotype->id = $id;
|
||||
$promotype->value = PromotionTypeEnum::ephemeralProducts->value;
|
||||
$promotype->label = 'Pas de niveau 2';
|
||||
$promotype->save();
|
||||
}
|
||||
}
|
||||
28
database/seeders/SurveySeeder.php
Normal file
28
database/seeders/SurveySeeder.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\Surveys\SurveyCustomerEnum;
|
||||
use App\Enums\Surveys\SurveyDistributionNetworkEnum;
|
||||
use App\Models\Survey;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SurveySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Survey::factory(20)->make()->each(function (Survey $survey) {
|
||||
if ($survey->is_distributor) {
|
||||
$survey->type = \collect(SurveyDistributionNetworkEnum::cases())->random();
|
||||
} elseif ($survey->is_customer) {
|
||||
$survey->type = \collect(SurveyCustomerEnum::cases())->random();
|
||||
}
|
||||
$survey->save();
|
||||
});
|
||||
}
|
||||
}
|
||||
19
database/seeders/UserSeeder.php
Normal file
19
database/seeders/UserSeeder.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
User::factory(30)->create();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue