Good.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Good extends Model
  5. {
  6. protected $guarded = [];
  7. public static $templetOption = [
  8. [
  9. 'id' => 1,
  10. 'name' => '农药模板-张洲',
  11. 'value' => 'nongyao'
  12. ],
  13. [
  14. 'id' => 2,
  15. 'name' => '种子模板-禾美乐',
  16. 'value' => 'hemeile'
  17. ],
  18. [
  19. 'id' => 3,
  20. 'name' => '种子模板-玉米',
  21. 'value' => 'yumi'
  22. ],
  23. [
  24. 'id' => 4,
  25. 'name' => '种子模板-小麦',
  26. 'value' => 'xiaomai'
  27. ],
  28. [
  29. 'id' => 5,
  30. 'name' => '印刷厂-小麦',
  31. 'value' => 'yinshua'
  32. ],
  33. [
  34. 'id' => 6,
  35. 'name' => '刑总-玉米',
  36. 'value' => 'xzyumi'
  37. ],
  38. ];
  39. public function getYouxiaoAttribute($path)
  40. {
  41. if (!\Storage::disk('admin')->exists($path)) return '';
  42. if (\Illuminate\Support\Str::startsWith($path, ['http://', 'https://'])) {
  43. return $path;
  44. }
  45. return \Storage::disk('admin')->url($path);
  46. }
  47. }