app/Containers/Import/UI/CLI/Commands/ExtractFlickrFarmerImagesCommand.php
/**
     * Execute the console command.
     *
     * @return void
     */
Execute the console command.
@return void
Execute the console command . @return void
public function handle()
    {
        $this->info('Extracting farmer images...');
        $farmers = Farmer::whereNotNull('flickr_photo')->get();
        $this->info("{$farmers->count()} farmers with flickr photo found.");
        $this->output->progressStart(count($farmers));
        foreach ($farmers as $farmer) {
            $this->output->progressAdvance();
            $photoId = $farmer->flickr_photo;
            if ($this->checkFile($photoId)) continue;
            try {
                $this->importFlickrPhotoById($photoId);
            } catch (\Exception $e) {
                continue;
            }
        }
        $this->output->progressFinish();
    }
public function handle ( ) { $ this -> info ( 'Extracting farmer images...' ) ; $ farmers = Farmer :: whereNotNull ( 'flickr_photo' ) -> get ( ) ; $ this -> info ( " { $ farmers -> count ( ) }  farmers with flickr photo found. " ) ; $ this -> output -> progressStart ( count ( $ farmers ) ) ; foreach ( $ farmers as $ farmer ) { $ this -> output -> progressAdvance ( ) ; $ photoId = $ farmer -> flickr_photo ; if ( $ this -> checkFile ( $ photoId ) ) continue ; try { $ this -> importFlickrPhotoById ( $ photoId ) ; } catch ( \ Exception $ e ) { continue ; } } $ this -> output -> progressFinish ( ) ; }
Execute the console command.
Execute the console command .
//get all farmers with flickr_photo //foreach get flickr data //check, if file is already downloaded