You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
812 B
PHP
37 lines
812 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class ProcesoAdmisionResultadoArchivo extends Model
|
|
{
|
|
protected $table = 'proceso_admision_resultado_archivos';
|
|
|
|
protected $fillable = [
|
|
'proceso_admision_id',
|
|
'nombre',
|
|
'file_path',
|
|
'orden',
|
|
];
|
|
|
|
protected $casts = [
|
|
'orden' => 'integer',
|
|
];
|
|
|
|
protected $appends = ['archivo_url'];
|
|
|
|
public function getArchivoUrlAttribute(): ?string
|
|
{
|
|
return $this->file_path
|
|
? Storage::disk('public')->url($this->file_path)
|
|
: null;
|
|
}
|
|
|
|
public function proceso(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(ProcesoAdmision::class, 'proceso_admision_id');
|
|
}
|
|
}
|