attributes['ofp_xml'])) { return null; } if (!$this->xml_instance) { $this->xml_instance = simplexml_load_string( $this->attributes['ofp_xml'], SimBriefXML::class ); } return $this->xml_instance; } /** * Returns a list of images */ public function getImagesAttribute(): Collection { return $this->xml->getImages(); } /** * Return all of the flight plans */ public function getFilesAttribute(): Collection { return $this->xml->getFlightPlans(); } /* * Relationships */ public function flight() { if (!empty($this->attributes['flight_id'])) { return $this->belongsTo(Flight::class, 'flight_id'); } if (!empty($this->attributes['pirep_id'])) { return $this->belongsTo(Pirep::class, 'pirep_id'); } } public function user() { return $this->belongsTo(User::class, 'user_id'); } }