コード例 #1
0
ファイル: Currencies.php プロジェクト: emayk/ics
 /**
  * @param bool $resultIds
  *
  * @return array|string
  * @throws \Exception
  */
 public static function generateMassive($resultIds = false)
 {
     $countries = Locations::where('level', 1);
     if (!$countries->count()) {
         throw new Exception('Negara Masih Kosong , Isi Dl');
     }
     $fake = static::getFake()->getCurrency();
     $ListCurrency = $fake->getCurrencies();
     $ids = array();
     foreach ($ListCurrency as $curr) {
         /*dapatkan ID*/
         $countryName = $curr['country'];
         $currName = $curr['name'];
         $currSymbol = $curr['symbol'];
         $country = Locations::whereName($countryName);
         if ($country->count()) {
             /*Jika Country Ada*/
             $countryId = $country->pluck('id');
             $record = $fake->createRecordCurrency($countryId, $currName, $currSymbol);
             $newrecord = static::createRecord($record);
             $ids[] = $newrecord->id;
         }
     }
     return $resultIds ? $ids : "Generate Currency with " . count($ids) . " records";
 }
コード例 #2
0
ファイル: LocationsEloquent.php プロジェクト: emayk/ics
 /**
  * Update Informasi [[cName]]
  *
  * @param $id
  *
  * @return mixed
  */
 public function update($id)
 {
     /**
      * test
      */
     $db = $this->locations->find($id);
     /*==========  Sesuaikan  ==========*/
     //		$db->name      = Input::get('name');
     $db->info = Input::get('info');
     //		$db->parent_id = Input::get('parent_id');
     $db->uuid = uniqid('Update_');
     $saved = $db->save();
     return $saved ? Response::json(array_merge($db->toArray(), array('success' => $saved))) : \Icsoutput::msgError(array('reason' => 'Cannot Update'));
 }
コード例 #3
0
ファイル: SampleData.php プロジェクト: emayk/ics
 /**
  * @param bool $resultsIds
  * @param int  $count
  *
  * @return array|string
  */
 public static function generateMassiveDummy($resultsIds = false, $count = 100)
 {
     /** Buat Data fake Instance */
     $fake = static::getFake()->getSupplier();
     /** Cari Legalitas */
     $listLegalitiesId = Legality::getIdsOrGenerateDummyData(100);
     /** Status */
     $listStatusId = Status::getIdsOrCreate();
     /*Product Type*/
     $typeProductIds = Producttype::getIdsOrCreateDummy(100);
     /*Type Supplier*/
     $typeIdsSupBuy = Typesuppliersbuyers::generateDummyData(true);
     /** Locations */
     $countryId = Locations::getIdsDefaultCountryOrCreate();
     $provinceId = Locations::getIdsDefaultProvinceOrCreate($countryId);
     $cityId = Locations::getIdsDefaultCityOrCreate($provinceId);
     $suppliers = $fake->generateSuppliers($count, $typeIdsSupBuy, $typeProductIds, $listLegalitiesId, $countryId, $provinceId, $cityId, $listStatusId);
     foreach ($suppliers as $sup) {
         $s = static::create($sup);
         $supIds[] = $s->id;
     }
     Log::debug('Supplier Masih Kosong , Sudah diisi ' . count($supIds));
     return $resultsIds ? $supIds : "Generate " . count($supIds) . " records";
 }
コード例 #4
0
ファイル: Buyers.php プロジェクト: emayk/ics
 /**
  * @param bool $resultsIds
  * @param int $count
  *
  * @return array|string
  */
 public static function generateDummyData($resultsIds = false, $count = 10)
 {
     /** Legalitas */
     $listLegalitiesId = Legality::getIdsOrGenerateDummyData(100);
     /** Status */
     $listStatusId = Status::getIdsOrCreate();
     /*Product Type*/
     $typeProductIds = Producttype::getIdsOrCreateDummy(100);
     /*Type Supplier*/
     $typeIdsSupBuy = Typesuppliersbuyers::generateDummyData(true);
     /** Locations */
     $countryId = Locations::getIdsDefaultCountryOrCreate();
     $provinceId = Locations::getIdsDefaultProvinceOrCreate($countryId);
     $cityId = Locations::getIdsDefaultCityOrCreate($provinceId);
     $records = static::getFake()->getBuyers()->createBuyers($count, $typeIdsSupBuy, $typeProductIds, $listLegalitiesId, $countryId, $provinceId, $cityId, $listStatusId);
     foreach ($records as $record) {
         $newrecord = static::createRecord($record);
         $recordIds[] = $newrecord->id;
     }
     \Log::debug('Supplier Masih Kosong , Sudah diisi ' . count($recordIds));
     return $resultsIds ? $recordIds : "Generate " . count($recordIds) . " records";
 }
コード例 #5
0
ファイル: Eloquent.php プロジェクト: emayk/ics
 /**
  * Generate Data Warehouse Jika Belum Ada
  *
  * @return bool|int|mixed
  */
 public function generateWarehouse()
 {
     /*
      * Warehouse Memerlukan Category
      *
      * maka sebelumnya dibuatkan dl
      * - Warehouse Category
      * - City
      * -
      */
     if ($this->emptyWarehouse()) {
         DB::beginTransaction();
         $catwh = Warehousecategory::create(array('id' => 1, 'name' => 'Pusat', 'info' => 'Gudang Utama'));
         $ptype = 'Emayk\\Ics\\Repo\\Locations\\Locations';
         $uid = $this->uid();
         $fake = new AbstractGenerate();
         $fake = $fake->getFake();
         $uuid = $fake->uuid;
         Locations::insert(array(array('id' => 1, 'name' => 'Indonesia', 'level' => 1, 'parent_id' => 0, 'parent_type' => $ptype, 'uuid' => $uuid, 'createby_id' => $uid, 'lastupdateby_id' => $uid), array('id' => 2, 'name' => 'Jawa Barat', 'level' => 2, 'parent_id' => 1, 'parent_type' => $ptype, 'uuid' => $uuid, 'createby_id' => $uid, 'lastupdateby_id' => $uid), array('id' => 3, 'name' => 'Bandung', 'level' => 3, 'parent_id' => 2, 'parent_type' => $ptype, 'uuid' => $uuid, 'createby_id' => $uid, 'lastupdateby_id' => $uid)));
         $cityId = 3;
         $wh = Warehouse::create(array('id' => 1, 'name' => 'Gudang Utama', 'address' => $fake->streetAddress, 'city_id' => $cityId, 'cat_id' => $catwh->id, 'uuid' => $uuid, 'createby_id' => $uid, 'lastupdateby_id' => $uid));
         DB::commit();
         return $wh->id;
     }
     return false;
 }
コード例 #6
0
ファイル: Warehouse.php プロジェクト: emayk/ics
 /**
  * @return int|mixed
  */
 public static function getDefaultWarehouseIdOrCreate()
 {
     $id = static::Name(static::$defaultName)->pluck('id');
     if (null == $id) {
         /* Create Record */
         $countryId = Locations::getIdsDefaultCountryOrCreate();
         $provinceId = Locations::getIdsDefaultProvinceOrCreate($countryId);
         $cityId = Locations::getIdsDefaultCityOrCreate($provinceId);
         $catId = Warehousecategory::getIdDefaultWarehouseCategoryOrCreate();
         $wh = static::create(static::getFake()->getWarehouse()->createWarehouse(static::$defaultName, $cityId, $catId));
         $id = $wh->id;
     }
     return $id;
 }
コード例 #7
0
ファイル: test.php プロジェクト: emayk/ics
     //			return \Emayk\Ics\Repo\Fabricgrade\Fabricgrade::generateMassive(true);
     //			return \Emayk\Ics\Repo\Fabrictype\Fabrictype::generateMassive();
 });
 /**
  * Generate Legality
  * $ids = true, menghasilkan array berisi id yang telah dibuat;
  * \Emayk\Ics\Repo\Legality\Legality::generateMassiveLegality($ids)
  */
 Route::get('legality', function () {
     return \Emayk\Ics\Repo\Legality\Legality::generateMassiveLegality();
 });
 /**
  * Generate Locations
  */
 Route::get('locations', function () {
     return \Emayk\Ics\Repo\Locations\Locations::generateMassiveLocation();
 });
 Route::get('useradmin', function () {
     return \Emayk\Ics\Repo\Users\Users::generateUserAdmin();
 });
 Route::get('users', function () {
     $fake = new \Emayk\Ics\Support\Dummy\Faker\AbstractGenerate();
     return $fake->getFake()->firstName;
 });
 Route::get('app.js', function () {
     $test = time();
     $contents = View::make('ics::extjs.app', compact('test'));
     $response = Response::make($contents);
     $response->header('Content-Type', 'application/javascript');
     return $response;
 });