| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- class Import extends Model
- {
- use HasFactory;
- const DEFAULT_SORT_BY = 'created_at';
- const STATUS_PENDING = 'pending';
- const STATUS_COMPLETED = 'completed';
- const STATUS_FAILED = 'failed';
- protected $fillable = [
- 'type',
- 'year',
- 'filename',
- 'status',
- 'result',
- 'user_id',
- 'file_path',
- 'original_filename',
- ];
- public function log(string $message, string $level = 'INFO'): string
- {
- $d = date('Y-m-d H:i:s', strtotime('now'));
- $string = "$d\t$level:\t$message\n";
- $this->result = $this->result . $string;
- return $string;
- }
- }
|