123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Models\Course;
- use Illuminate\Database\Eloquent\Model;
- use DateTimeInterface;
- class Share extends Model
- {
- protected $connection = 'mysql_c';
- protected $table='share';
- protected $guarded=[];
- protected function serializeDate(DateTimeInterface $date): string
- {
- return $date->format('Y-m-d H:i:s');
- }
- public function user(){
- return $this->hasOne(App\Models\User::class,'id','user_id')->withTrashed();
- }
- public function course(): \Illuminate\Database\Eloquent\Relations\HasOne
- {
- return $this->hasOne(Course::class,'id','course_id','deleted_at')->withTrashed();
- }
- }
|