You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
562 B

  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class DraftEmbed extends Model
  5. {
  6. protected $table = 'embeds';
  7. public function draft()
  8. {
  9. return $this->belongsTo(Draft::class);
  10. }
  11. public function getHTMLIdAttribute()
  12. {
  13. return cleanupId('embed'.$this->id);
  14. }
  15. public function resolve(?int $timeout = 30): ?Url
  16. {
  17. try {
  18. return Url::resolve($this->url, $timeout);
  19. } catch (\Exception $e) {
  20. error_log($e->getMessage());
  21. }
  22. return null;
  23. }
  24. }