Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. $a = new task();
  2. $a->title = 'hello world';
  3. $a->save()
  4.  
  5. Now I would like $a to be realated to the tasktype, a person who made this, and a department.
  6. Rather than doing:
  7.  
  8. $tasktype = new Tasktype();
  9. $tasktype->where(id,12)->get();
  10. $person = new Person();
  11. $person->where(id,2)->get();
  12.  
  13. $a->save($tasktype, $person->all);
  14.  
  15.  
  16. Could perhaps do something like:
  17.  
  18. $relateto = array(
  19. 'person', 2,
  20. 'tasktype', 12
  21. )
  22. $a->saverelations($relateto);
  23.  
  24. Thoughts?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement