Guest User

Untitled

a guest
Mar 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Themes
  2. id - integer
  3. composer_package - string
  4. name - string
  5.  
  6. Plugins
  7. id - integer
  8. composer_package - string
  9. name - string
  10.  
  11.  
  12. Products
  13. id - integer
  14. name - string
  15. ...
  16. productable_id - integer
  17. productable_type - string
  18.  
  19. public function store(Request $request)
  20. {
  21. $selectedTheme = null;
  22. foreach($request->input('theme') as $key => $value) {
  23. if($value === 'selected') {
  24. $selectedTheme = $key;
  25. }
  26. }
  27.  
  28. $theme = Product::find($selectedTheme);
  29.  
  30.  
  31.  
  32. foreach($this->predefinedArray as $value) {
  33. $request->session()->put('chosen_theme.' . $value, $theme->$value);
  34. }
  35.  
  36.  
  37. $data = $request->session()->all();
  38.  
  39. return redirect('plugins');
  40. }
  41.  
  42. public function productable()
  43. {
  44. return $this->morphTo();
  45. }
  46.  
  47.  
  48. public function order_items()
  49. {
  50. return $this->hasMany(Orderitems::class);
  51. }
  52.  
  53. public function webshops()
  54. {
  55. return $this->hasMany(Webshop::class);
  56. }
  57.  
  58.  
  59. public function products()
  60. {
  61. return $this->morphMany(Product::class, 'productable');
  62. }
Add Comment
Please, Sign In to add comment