Message.php 391 B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Message extends Model
  5. {
  6. protected $table='message';
  7. protected $fillable=['user_id','activity_id','content','pid'];
  8. public function user(){
  9. return $this->belongsTo(User::class,'user_id');
  10. }
  11. public function messages()
  12. {
  13. return $this->hasMany(Message::class, 'pid');
  14. }
  15. }