Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. users:
  2. |id|username|
  3.  
  4. tickets:
  5. |id|user_id|
  6.  
  7. ticket_replies:
  8. id|ticket_id|user_id|
  9.  
  10. files:
  11. |id|ticket_replie_id|name
  12.  
  13. user:
  14. public function tickets()
  15. {
  16. return $this->hasMany('Appticket');
  17. }
  18.  
  19. ticket:
  20. public function ticket_replie()
  21. {
  22. return $this->hasMany('Appticket_replie', 'ticket_id', 'id');
  23. }
  24.  
  25. ticket_replie:
  26. public function file()
  27. {
  28. return $this->hasOne('AppFile', 'ticket_replie_id', 'id');
  29. }
  30.  
  31. $ticket = Auth::user()->tickets()->where('tickets.id', $id)->where('files.ticket_replie_id', $attachment_id)->firstOrFail();
  32.  
  33. select * from `tickets` where `tickets`.`user_id` = 1 and `tickets`.`user_id` is not null and `tickets`.`id` = 43 and `files`.`ticket_replie_id` = 39 limit 1
  34.  
  35. Column not found: 1054 Unknown column 'files.ticket_replie_id' in 'where clause
  36.  
  37. select * from `tickets`, `files` where `tickets`.`user_id` = 1 and `tickets`.`user_id` is not null and `tickets`.`id` = 43 and `files`.`ticket_replie_id` = 39 limit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement