Import.php 524 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Import extends Model
  5. {
  6. const DEFAULT_SORT_BY = 'created_at';
  7. protected $fillable = [
  8. 'type',
  9. 'year',
  10. 'filename',
  11. 'status',
  12. 'result',
  13. ];
  14. public function log(string $message, string $level = 'INFO'): string
  15. {
  16. $d = date('Y-m-d H:i:s', strtotime('now'));
  17. $string = "$d\t$level:\t$message\n";
  18. $this->result = $this->result . $string;
  19. return $string;
  20. }
  21. }