Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Modelo Respuesta:
  2.  
  3.  
  4. <?php
  5.  
  6. namespace App;
  7.  
  8. use Illuminate\Database\Eloquent\Model;
  9.  
  10. class Respuesta extends Model
  11. {
  12. protected $table = 'respuesta';
  13.  
  14. protected $fillable = [
  15. 'respuesta',
  16. 'comentario_id',
  17. 'user_id'
  18. ];
  19.  
  20. public function comentario(){
  21. return $this->belongsTo('App\Comentario');
  22. }
  23.  
  24. public function usuario(){
  25. return $this->belongsTo('App\User');
  26. }
  27. }
  28.  
  29. Modelo Comentario
  30.  
  31. <?php
  32.  
  33. namespace App;
  34.  
  35. use Illuminate\Database\Eloquent\Model;
  36.  
  37. class Comentario extends Model
  38. {
  39. protected $table = 'comentario';
  40.  
  41. protected $fillable = [
  42. 'comentario',
  43. 'obra_id',
  44. 'user_id'
  45. ];
  46.  
  47. public function obra(){
  48. return $this->belongsTo('App\Obra');
  49. }
  50.  
  51. public function usuario(){
  52. return $this->belongsTo('App\User');
  53. }
  54.  
  55. public function respuestas(){
  56. return $this->hasMany('App\Respuesta');
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement