123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Models\Wetalk;
- use Illuminate\Database\Eloquent\Model;
- use DateTimeInterface;
- use App\Models\User;
- class Comment extends Model
- {
- protected $connection = 'mysql_t';
- protected $table='comment';
- protected $guarded=[];
- protected function serializeDate(DateTimeInterface $date): string
- {
- return $date->format('Y-m-d H:i:s');
- }
- public function user(){
- // $instance = new User;
- // $instance->setConnection('mysql');
- // $query = $instance->newQuery();
- // return $this->hasOne($query, $this,'id','user_id');
- return $this->hasOne('App\Models\User','id','user_id');
- }
- }
|