1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Models\Wetalk;
- use Illuminate\Database\Eloquent\Model;
- use DateTimeInterface;
- class Article extends Model
- {
- protected $connection = 'mysql_t';
- protected $table='article';
- protected $guarded=[];
- protected $appends=['all_audio'];
- protected function serializeDate(DateTimeInterface $date): string
- {
- return $date->format('Y-m-d H:i:s');
- }
- public function getAllAudioAttribute($key)
- {
- $domain='https://weiliao.woaidakele.cn/storage/';
- $audio=$this->attributes['audio'];
- if(!empty($audio)){
- return $domain.$audio;
- }else{
- return '';
- }
- }
- }
|