| @@ 46-65 (lines=20) @@ | ||
| 43 | * |
|
| 44 | * @return \Illuminate\Http\RedirectResponse |
|
| 45 | */ |
|
| 46 | public function store(ThemeFormRequest $request) |
|
| 47 | { |
|
| 48 | $theme = new Theme(); |
|
| 49 | ||
| 50 | $theme->name = $request->name; |
|
| 51 | ||
| 52 | $theme->selected = $request->has('selected'); |
|
| 53 | ||
| 54 | $theme->updateColors($request->all()); |
|
| 55 | ||
| 56 | $theme->save(); |
|
| 57 | ||
| 58 | if ($theme->selected) { |
|
| 59 | $theme->disableOtherThemes(); |
|
| 60 | } |
|
| 61 | ||
| 62 | Notificator::success('Theme created successfully'); |
|
| 63 | ||
| 64 | return redirect()->route('backend.themes.edit', $theme); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Show the form for editing the specified resource. |
|
| @@ 87-104 (lines=18) @@ | ||
| 84 | * |
|
| 85 | * @return \Illuminate\Http\RedirectResponse |
|
| 86 | */ |
|
| 87 | public function update(ThemeFormRequest $request, Theme $theme) |
|
| 88 | { |
|
| 89 | $theme->name = $request->name; |
|
| 90 | ||
| 91 | $theme->selected = $request->has('selected'); |
|
| 92 | ||
| 93 | $theme->updatecolors($request->all()); |
|
| 94 | ||
| 95 | $theme->save(); |
|
| 96 | ||
| 97 | if ($theme->selected) { |
|
| 98 | $theme->disableOtherThemes(); |
|
| 99 | } |
|
| 100 | ||
| 101 | Notificator::success('Theme edited successfully'); |
|
| 102 | ||
| 103 | return redirect()->route('backend.themes.edit', $theme); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Remove the specified resource from storage. |
|