Ejemplo n.º 1
0
 /**
  * Generate Data Massive Contact Person
  *
  * @param bool $resultIds
  *
  * @param int  $count
  *
  * @return array|string
  */
 public static function generateMassive($resultIds = false, $count = 100)
 {
     $posIds = Positions::getIdsPositionOrCreateMassiveDummy();
     $deptIds = Dept::getIdsOrCreateMassiveDummy();
     $supplierIds = Suppliers::getRecordIdsOrCreate(200);
     $buyerIds = Buyers::getRecordIdsOrCreate(200);
     $records = static::getFake()->getContacts()->generateContacts($count, $posIds, $deptIds, $supplierIds, $buyerIds);
     $contacts = array();
     foreach ($records as $record) {
         $newrecord = static::create($record);
         $contacts[] = $newrecord->id;
     }
     return $resultIds ? $contacts : 'Generate Contact Person with ' . count($contacts) . ' records';
 }
Ejemplo n.º 2
0
 /**
  * @param int $count
  *
  * @return array
  */
 public static function getIdsPositionOrCreateMassiveDummy($count = 10)
 {
     $posIds = static::lists('id');
     if (!count($posIds)) {
         $default = array(static::getIdDefaultPositionOrCreate());
         $newRecords = Positions::generateMassiveDataDummy(true, $count);
         $posIds = array_merge($default, $newRecords);
     }
     return $posIds;
 }
Ejemplo n.º 3
0
 /**
  * @return Model|static
  * @throws \Exception
  */
 public static function generateUserAdmin()
 {
     $username = static::$defaultUserAdmin['username'];
     $useradmin = self::Username($username);
     if ($useradmin->count()) {
         $msg = '[Error] User Admin Sudah Dibuat sebelumnya';
     } else {
         $posId = Positions::getIdDefaultPositionOrCreate();
         $deptId = Dept::getIdDefaultDepartementOrCreate();
         $warehouseId = Warehouse::getDefaultWarehouseIdOrCreate();
         $statusId = Status::getIdDefaultStatusOrCreate();
         $user = self::create(array_merge(array('username' => static::$defaultUserAdmin['username'], 'fullname' => lcfirst(static::$defaultUserAdmin['username']), 'email' => static::getFake()->getFake()->companyEmail, 'pos_id' => $posId, 'dept_id' => $deptId, 'warehouse_id' => $warehouseId, 'status_id' => $statusId, 'password' => static::$defaultUserAdmin['password']), static::getFake()->othersAttributesArray()));
         $msg = "Generate User Admin {$user->username} Successfully";
     }
     return $msg;
 }
Ejemplo n.º 4
0
Archivo: test.php Proyecto: emayk/ics
 echo \Emayk\Ics\Repo\Users\Users::generateUserAdmin();
 sleep(1);
 echo $sep;
 //Legalitas
 echo "Generate Legality ...";
 echo \Emayk\Ics\Repo\Legality\Legality::generateMassiveLegality();
 sleep(1);
 echo $sep;
 //departement
 echo "Generate Departement ...";
 echo \Emayk\Ics\Repo\Dept\Dept::generateMassive();
 echo $sep;
 sleep(1);
 //Position
 echo "Generate Position ...";
 echo \Emayk\Ics\Repo\Positions\Positions::generateMassiveDataDummy(false, 50);
 echo $sep;
 sleep(1);
 //Color
 echo "Generate Color ";
 echo \Emayk\Ics\Repo\Colors\Colors::generateColorSample();
 sleep(1);
 echo $sep;
 //Location
 echo "Generate Default Location ";
 echo \Emayk\Ics\Repo\Locations\Locations::createRecordCountry();
 sleep(1);
 echo $sep;
 //currency
 echo "Generate Currency ";
 echo \Emayk\Ics\Repo\Currencies\Currencies::generateMassive();