-
app/Models/Exception.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; class Exception extends Model { public function getHumanDateAttribute() { return $this->created_at->diffForHumans(); } }
-
resources/views/home.blade.php
Open in GitHub<div class="block-content block-content-full block-content-sm bg-body-light"> <span class="font-size-sm text-muted">Project <strong>{{ $exception->project->title }}</strong> at <strong>{{ $exception->created_at }} ({{ $exception->human_date }})</strong></span> </div>
-
app/Http/Resources/Api/ExceptionResource.php
Open in GitHubuse Illuminate\Http\Resources\Json\JsonResource; class ExceptionResource extends JsonResource { public function toArray($request) { return [ 'id' => $this->id, 'human_date' => $this->human_date, ]; } }