7d854ffb0a
- Translation system: lang/es/ PHP files (auth, validation, pagination, passwords)
- Rappasoft vendor translations published (lang/vendor/livewire-tables/es/)
- JSON files synced to 391 keys (EN + ES, full parity)
- APP_LOCALE changed to 'es', users.locale column default changed to 'es'
- Language switcher fixed: JS event + window.location.reload() avoids /livewire/update redirect
- SetLocale middleware fallback uses config('app.locale') instead of hardcoded 'en'
- setSortingPillsEnabled(false) on ProjectTable, CompanyTable, UserTable
- Translated 17 blade views: project-map, template-manager, layer-manager,
company-management, phase-list, media-manager, reports-dashboard,
client-projects, layer-upload, project-form, project-map-editor-tab,
admin/users, projects/media, projects/templates, layouts/client
- Navigation 'Empresas' link uses __('Companies')
- Fixed typo key 'Fases and layers' -> 'Phases and layers'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
<?php
|
|
namespace App\Models;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Phase extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'project_id', 'name', 'description', 'order', 'color', 'progress_percent',
|
|
'planned_start', 'planned_end', 'actual_start', 'actual_end'
|
|
];
|
|
|
|
protected $casts = [
|
|
'planned_start' => 'date',
|
|
'planned_end' => 'date',
|
|
'actual_start' => 'date',
|
|
'actual_end' => 'date',
|
|
];
|
|
|
|
public function project() { return $this->belongsTo(Project::class); }
|
|
public function layers() { return $this->hasMany(Layer::class); }
|
|
public function progressUpdates() { return $this->hasMany(ProgressUpdate::class); }
|
|
public function currentLayer() { return $this->hasOne(Layer::class)->latestOfMany(); }
|
|
public function features() { return $this->hasManyThrough(Feature::class, Layer::class); }
|
|
public function media() { return $this->morphMany(Media::class, 'mediable'); }
|
|
public function images() { return $this->morphMany(Media::class, 'mediable')->where('category', 'image'); }
|
|
|
|
public function getDeviationDaysAttribute(): ?int
|
|
{
|
|
if (!$this->planned_end) return null;
|
|
$end = $this->actual_end ?? now();
|
|
return $this->planned_end->diffInDays($end, false);
|
|
}
|
|
}
|