|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace DavideCasiraghi\ResponsiveGallery\Http\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use DavideCasiraghi\ResponsiveGallery\Models\GalleryImage; |
|
6
|
|
|
use Illuminate\Http\Request; |
|
7
|
|
|
use Validator; |
|
8
|
|
|
|
|
9
|
|
|
//use DavideCasiraghi\ResponsiveGallery\Facades\ResponsiveGallery; |
|
10
|
|
|
|
|
11
|
|
|
class ResponsiveGalleryController |
|
12
|
|
|
{ |
|
13
|
|
|
/***************************************************************************/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Display a listing of the resource. |
|
17
|
|
|
* |
|
18
|
|
|
* @return \Illuminate\Http\Response |
|
19
|
|
|
*/ |
|
20
|
2 |
|
public function index(Request $request) |
|
21
|
|
|
{ |
|
22
|
2 |
|
$searchKeywords = $request->input('keywords'); |
|
23
|
|
|
|
|
24
|
2 |
|
if ($searchKeywords) { |
|
25
|
|
|
$galleryImages = GalleryImage::orderBy('file_name') |
|
26
|
|
|
->where('file_name', 'like', '%'.$request->input('keywords').'%') |
|
27
|
|
|
->paginate(20); |
|
28
|
|
|
} else { |
|
29
|
2 |
|
$galleryImages = GalleryImage::orderBy('file_name') |
|
30
|
2 |
|
->paginate(20); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
2 |
|
return view('laravel-responsive-gallery::index', compact('galleryImages')) |
|
34
|
2 |
|
->with('i', (request()->input('page', 1) - 1) * 20) |
|
35
|
2 |
|
->with('searchKeywords', $searchKeywords); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/***************************************************************************/ |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Show the form for creating a new resource. |
|
42
|
|
|
* |
|
43
|
|
|
* @return \Illuminate\Http\Response |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public function create() |
|
46
|
|
|
{ |
|
47
|
1 |
|
return view('laravel-responsive-gallery::create'); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/***************************************************************************/ |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Store a newly created resource in storage. |
|
54
|
|
|
* |
|
55
|
|
|
* @param \Illuminate\Http\Request $request |
|
56
|
|
|
* @return \Illuminate\Http\Response |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public function store(Request $request) |
|
59
|
|
|
{ |
|
60
|
|
|
/*$validator = Validator::make($request->all(), [ |
|
61
|
|
|
'file_name' => 'required', |
|
62
|
|
|
]); |
|
63
|
|
|
if ($validator->fails()) { |
|
64
|
|
|
return back()->withErrors($validator)->withInput(); |
|
65
|
|
|
}*/ |
|
66
|
|
|
|
|
67
|
1 |
|
$gallery_image = new GalleryImage(); |
|
68
|
1 |
|
$gallery_image->file_name = $request->get('file_name'); |
|
69
|
1 |
|
$gallery_image->description = $request->get('description'); |
|
70
|
1 |
|
$gallery_image->alt = $request->get('alt'); |
|
71
|
1 |
|
$gallery_image->video_link = $request->get('video_link'); |
|
72
|
|
|
|
|
73
|
1 |
|
$gallery_image->save(); |
|
74
|
|
|
|
|
75
|
1 |
|
return redirect()->route('responsive-gallery.index') |
|
76
|
1 |
|
->with('success', 'Image datas added succesfully'); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/***************************************************************************/ |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Display the specified resource. |
|
83
|
|
|
* |
|
84
|
|
|
* @param \App\Country $country |
|
|
|
|
|
|
85
|
|
|
* @return \Illuminate\Http\Response |
|
86
|
|
|
*/ |
|
87
|
1 |
|
public function show($id = null) |
|
88
|
|
|
{ |
|
89
|
1 |
|
$galleryImage = GalleryImage::find($id); |
|
90
|
|
|
|
|
91
|
1 |
|
return view('laravel-responsive-gallery::show', compact('galleryImage')); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/***************************************************************************/ |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Show the form for editing the specified resource. |
|
98
|
|
|
* |
|
99
|
|
|
* @param \App\Country $country |
|
100
|
|
|
* @return \Illuminate\Http\Response |
|
101
|
|
|
*/ |
|
102
|
1 |
|
public function edit($id = null) |
|
103
|
|
|
{ |
|
104
|
1 |
|
$galleryImage = GalleryImage::find($id); |
|
105
|
|
|
|
|
106
|
1 |
|
return view('laravel-responsive-gallery::edit', compact('galleryImage')); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/***************************************************************************/ |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Update the specified resource in storage. |
|
113
|
|
|
* |
|
114
|
|
|
* @param \Illuminate\Http\Request $request |
|
115
|
|
|
* @param \App\Country $country |
|
116
|
|
|
* @return \Illuminate\Http\Response |
|
117
|
|
|
*/ |
|
118
|
1 |
|
public function update(Request $request, $id) |
|
119
|
|
|
{ |
|
120
|
|
|
/*$validator = Validator::make($request->all(), [ |
|
121
|
|
|
'file_name' => 'required', |
|
122
|
|
|
])->validate();*/ |
|
123
|
|
|
|
|
124
|
1 |
|
$galleryImage = GalleryImage::find($id); |
|
125
|
|
|
|
|
126
|
1 |
|
$galleryImage->update($request->all()); |
|
127
|
|
|
|
|
128
|
1 |
|
return redirect()->route('responsive-gallery.index') |
|
129
|
1 |
|
->with('success', 'Image datas updated succesfully'); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/***************************************************************************/ |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* Remove the specified resource from storage. |
|
136
|
|
|
* |
|
137
|
|
|
* @param \App\Country $country |
|
138
|
|
|
* @return \Illuminate\Http\Response |
|
139
|
|
|
*/ |
|
140
|
1 |
|
public function destroy($id) |
|
141
|
|
|
{ |
|
142
|
1 |
|
$galleryImage = GalleryImage::find($id); |
|
143
|
1 |
|
$galleryImage->delete(); |
|
144
|
|
|
|
|
145
|
1 |
|
return redirect()->route('responsive-gallery.index') |
|
146
|
1 |
|
->with('success', 'Image datas deleted succesfully'); |
|
147
|
|
|
} |
|
148
|
|
|
} |
|
149
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths