コード例 #1
0
 /**
  * Called when data is being imported.
  * The $results array should be in the format of:
  *
  *    [
  *        'db_name1' => 'Some value',
  *        'db_name2' => 'Another value'
  *    ],
  *    [...]
  *
  */
 public function importData($results, $sessionKey = null)
 {
     foreach ($results as $row => $data) {
         try {
             $data['parameters_lists'] = json_decode($data['parameters_lists']);
             UrlDynamic::create($data);
             $this->logCreated();
         } catch (\Exception $e) {
             $this->logError($row, $e->getMessage());
         }
     }
 }
コード例 #2
0
 public function onSearchDynamics()
 {
     $pageCrawler = new PagesCrawler();
     array_map(function ($pageInfo) {
         if (!UrlDynamic::query()->where('url', $pageInfo['url'])->first()) {
             UrlDynamic::create(['url' => $pageInfo['url'], 'parameters_lists' => array_map(function ($item) {
                 return ['name' => $item, 'code' => '<?php return [];'];
             }, $pageInfo['urlParameters'])]);
         }
     }, $pageCrawler->getPageInfos('dynamic'));
     return $this->listRefresh();
 }