src/Models/Article.php
public function fetchImages()
    {
        try {
            $api_client = new Client();
            $list = $api_client->getImagesByArticles($this->HailID);
        } catch (\Exception $ex) {
            return;
        }

        $hailIdList = [];

        // Clean before importing
        $this->ImageGallery()->removeAll();

        foreach ($list as $hailData) {
            // Build up Hail ID list
            $hailIdList[] = $hailData['id'];

            // Check if we can find an existing item.
            $hailObj = Image::get()->filter(['HailID' => $hailData['id']])->First();

            if (!$hailObj) {
                $hailObj = new Image();
            }
            $hailObj->OrganisationID = $this->OrganisationID;
            $hailObj->HailOrgID = $this->HailOrgID;
            $hailObj->HailOrgName = $this->HailOrgName;

            $hailObj->importHailData($hailData);
            $this->ImageGallery()->add($hailObj);
        }
    }
public function fetchImages()
    {
        try {
            $api_client = new Client();
            $list = $api_client->getImagesByArticles($this->HailID);
        } catch (\Exception $ex) {
            return;
        }

        $hailIdList = [];

        // Clean before importing
        $this->ImageGallery()->removeAll();

        foreach ($list as $hailData) {
            // Build up Hail ID list
            $hailIdList[] = $hailData['id'];

            // Check if we can find an existing item.
            $hailObj = Image::get()->filter(['HailID' => $hailData['id']])->First();

            if (!$hailObj) {
                $hailObj = new Image();
            }
            $hailObj->OrganisationID = $this->OrganisationID;
            $hailObj->HailOrgID = $this->HailOrgID;
            $hailObj->HailOrgName = $this->HailOrgName;

            $hailObj->importHailData($hailData);
            $this->ImageGallery()->add($hailObj);
        }
    }
public function fetchImages ( ) { try { $ api_client = new Client ( ) ; $ list = $ api_client -> getImagesByArticles ( $ this -> HailID ) ; } catch ( \ Exception $ ex ) { return ; } $ hailIdList = [ ] ; // Clean before importing
 $ this -> ImageGallery ( ) -> removeAll ( ) ; foreach ( $ list as $ hailData ) { // Build up Hail ID list
 $ hailIdList [ ] = $ hailData [ 'id' ] ; // Check if we can find an existing item.
 $ hailObj = Image :: get ( ) -> filter ( [ 'HailID' => $ hailData [ 'id' ] ] ) -> First ( ) ; if ( ! $ hailObj ) { $ hailObj = new Image ( ) ; } $ hailObj -> OrganisationID = $ this -> OrganisationID ; $ hailObj -> HailOrgID = $ this -> HailOrgID ; $ hailObj -> HailOrgName = $ this -> HailOrgName ; $ hailObj -> importHailData ( $ hailData ) ; $ this -> ImageGallery ( ) -> add ( $ hailObj ) ; } }
Fetch the image gallery of this article from the Hail API

@return void
@throws
Fetch the image gallery of this article from the Hail API