@@ 57-68 (lines=12) @@ | ||
54 | ||
55 | } |
|
56 | ||
57 | public function update(Request $request, Attachments $attachments, $id) |
|
58 | { |
|
59 | $attachment = $attachments->find($id); |
|
60 | ||
61 | $this->bCAuthorize('update', $attachment); |
|
62 | ||
63 | $attachment = $attachments->update($request->all(), $id); |
|
64 | ||
65 | Alert::add('success', trans('back-project::crud.model_updated', ['model' => trans('back-project::media.image')]))->flash(); |
|
66 | ||
67 | return redirect(route('bp.attachments.index')); |
|
68 | } |
|
69 | ||
70 | public function delete(Attachments $attachments, $id) |
|
71 | { |
|
@@ 83-98 (lines=16) @@ | ||
80 | return back(); |
|
81 | } |
|
82 | ||
83 | public function setMain(Attachments $attachments, $id) |
|
84 | { |
|
85 | $attachment = $attachments->find($id); |
|
86 | ||
87 | $this->bCAuthorize('update', $attachment); |
|
88 | ||
89 | $data = [ |
|
90 | 'is_main' => 1 |
|
91 | ]; |
|
92 | ||
93 | $attachments->update($data, $id); |
|
94 | ||
95 | Alert::add('success', trans('back-project::crud.model_updated', ['model' => trans('back-project::media.image')]))->flash(); |
|
96 | ||
97 | return redirect(route('bp.attachments.index')); |
|
98 | } |
|
99 | } |