@@ 62-76 (lines=15) @@ | ||
59 | return view('admin.reviews.edit', ['review' => $review]); |
|
60 | } |
|
61 | ||
62 | public function update(Requests\UpdateRequest $request, $id) |
|
63 | { |
|
64 | $review = AlbumReview::findOrFail($id); |
|
65 | $review->fill($request->except('img_name')); |
|
66 | ||
67 | if ($request->hasFile('img_name')) |
|
68 | { |
|
69 | $file = $request->file('img_name'); |
|
70 | $review->uploadFile('img_name', $file); |
|
71 | } |
|
72 | ||
73 | $review->save(); |
|
74 | return redirect()->route('admin.reviews.index') |
|
75 | ->with('success', 'Album Review Saved!'); |
|
76 | } |
|
77 | ||
78 | public function delete($id) |
|
79 | { |
@@ 45-63 (lines=19) @@ | ||
42 | * |
|
43 | * @return Response |
|
44 | */ |
|
45 | public function store(Requests\CreateRequest $request) |
|
46 | { |
|
47 | $dj = new DJ($request->all()); |
|
48 | ||
49 | if($request->hasFile('picture')) |
|
50 | { |
|
51 | $file = $request->file('picture'); |
|
52 | $dj->uploadFile('picture', $file); |
|
53 | } |
|
54 | else |
|
55 | { |
|
56 | $dj->picture = 'default.jpg'; |
|
57 | } |
|
58 | ||
59 | $dj->save(); |
|
60 | ||
61 | return redirect()->route('admin.djs.index') |
|
62 | ->with('success', 'DJ Created!'); |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * Show the form for editing the specified resource. |
|
@@ 84-98 (lines=15) @@ | ||
81 | * @param int $id |
|
82 | * @return Response |
|
83 | */ |
|
84 | public function update(Requests\UpdateRequest $request, $id) |
|
85 | { |
|
86 | $dj = DJ::findOrFail($id); |
|
87 | $dj->fill($request->except(['picture'])); |
|
88 | ||
89 | if($request->hasFile('picture')) |
|
90 | { |
|
91 | $file = $request->file('picture'); |
|
92 | $dj->uploadFile('picture', $file); |
|
93 | } |
|
94 | ||
95 | $dj->save(); |
|
96 | return redirect()->route('admin.djs.index') |
|
97 | ->with('success', 'DJ Saved!'); |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Remove the specified resource from storage. |