/ app / Models / Certificate.php
Certificate.php
 1  <?php
 2  
 3  namespace App\Models;
 4  
 5  use Illuminate\Database\Eloquent\Factories\HasFactory;
 6  use Illuminate\Database\Eloquent\Model;
 7  use Illuminate\Support\Facades\URL;
 8  
 9  class Certificate extends Model
10  {
11      use HasFactory;
12  
13      protected $fillable = [
14          'cuid',
15          'xml_path',
16          'file_name',
17          'file_hash',
18          'pdf_path',
19          'country',
20          'ncca',
21          'cab',
22          'status',
23          'message',
24          'qr_code',
25      ];
26  
27  
28      public function certificateInfo()
29      {
30          return $this->hasOne(CertificateInfo::class);
31      }
32  
33      public function url()
34      {
35          return URL::signedRoute('documents.showXML', ['xml' => $this->id]);
36      }
37  
38      public function dossier()
39      {
40          return $this->belongsTo(Dossier::class)->withTrashed();
41      }
42  }