Import.php 508 B

12345678910111213141516171819202122232425
  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. 'filename',
  10. 'status',
  11. 'result',
  12. ];
  13. public function log(string $message, string $level = 'INFO'): string
  14. {
  15. $d = date('Y-m-d H:i:s', strtotime('now'));
  16. $string = "$d\t$level:\t$message\n";
  17. $this->result = $this->result . $string;
  18. return $string;
  19. }
  20. }