@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
36 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * The attributes that are mass assignable. |
40 | 40 | * |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $fillable = ['name', 'description', 'color']; |
|
43 | + protected $fillable = [ 'name', 'description', 'color' ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Columns to exclude from index |
47 | 47 | * |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $excludedFromIndex = []; |
|
50 | + protected $excludedFromIndex = [ ]; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Fields to search in fulltext mode |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return object |
84 | 84 | */ |
85 | - public function adverts(){ |
|
85 | + public function adverts() { |
|
86 | 86 | |
87 | 87 | return $this->belongsToMany('App\Advert', 'advert_advertlocation', 'advert_id', 'advertlocation_id'); |
88 | 88 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param type $query |
94 | 94 | * @return object |
95 | 95 | */ |
96 | - public function scopeRelationships($query){ |
|
96 | + public function scopeRelationships($query) { |
|
97 | 97 | |
98 | 98 | return $query->with('adverts'); |
99 | 99 | } |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @var array |
34 | 34 | */ |
35 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
35 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * The attributes that are mass assignable. |
39 | 39 | * |
40 | 40 | * @var array |
41 | 41 | */ |
42 | - protected $fillable = ['name', 'description', 'class']; |
|
42 | + protected $fillable = [ 'name', 'description', 'class' ]; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Columns to exclude from index |
46 | 46 | * |
47 | 47 | * @var array |
48 | 48 | */ |
49 | - protected $excludedFromIndex = []; |
|
49 | + protected $excludedFromIndex = [ ]; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Fields to search in fulltext mode |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return object |
88 | 88 | */ |
89 | - public function pages(){ |
|
89 | + public function pages() { |
|
90 | 90 | |
91 | 91 | return $this->belongsToMany('App\Page', 'page_pagecategory', 'page_id', 'pagecategory_id'); |
92 | 92 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param query $query |
98 | 98 | * @return query |
99 | 99 | */ |
100 | - public function scopeRelationships($query){ |
|
100 | + public function scopeRelationships($query) { |
|
101 | 101 | |
102 | 102 | return $query->with('pages'); |
103 | 103 | } |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
36 | + protected $dates = [ 'created_at', 'updated_at', 'deleted_at' ]; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * The attributes that are mass assignable. |
40 | 40 | * |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $fillable = ['name', 'description', 'position', 'image_id']; |
|
43 | + protected $fillable = [ 'name', 'description', 'position', 'image_id' ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Columns to exclude from index |
47 | 47 | * |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $excludedFromIndex = ['image']; |
|
50 | + protected $excludedFromIndex = [ 'image' ]; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Fields to search in fulltext mode |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return object |
85 | 85 | */ |
86 | - public function images(){ |
|
86 | + public function images() { |
|
87 | 87 | |
88 | 88 | return $this->belongsTo('App\Image', 'image_id')->select('id', 'name', 'description', |
89 | 89 | 'alt', 'url', 'imagecategory_id', 'image_mime_type', 'image_extension', |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param query $query |
98 | 98 | * @return query |
99 | 99 | */ |
100 | - public function scopeRelationships($query){ |
|
100 | + public function scopeRelationships($query) { |
|
101 | 101 | |
102 | 102 | return $query->with('images', 'images.imagecategories'); |
103 | 103 | } |
@@ -24,5 +24,5 @@ |
||
24 | 24 | protected $arValidationArray = [ |
25 | 25 | 'name' => 'required|max:255|unique:settings,name', |
26 | 26 | 'value' => 'max:255', |
27 | - 'description' => 'max:255']; |
|
27 | + 'description' => 'max:255' ]; |
|
28 | 28 | } |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * File not cached |
54 | 54 | */ |
55 | - else{ |
|
55 | + else { |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Get META information |
59 | 59 | */ |
60 | - $imageMeta = Image::where(['url' => $request->imageName, 'image_extension' => $request->imageExtension])->first(['image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag']); |
|
60 | + $imageMeta = Image::where([ 'url' => $request->imageName, 'image_extension' => $request->imageExtension ])->first([ 'image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag' ]); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * File does not exist |
64 | 64 | */ |
65 | - if(empty($imageMeta) == TRUE){ |
|
65 | + if (empty($imageMeta) == TRUE) { |
|
66 | 66 | App::abort(404); |
67 | 67 | } |
68 | 68 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'Content-Type' => $imageMeta->image_mime_type, |
92 | 92 | 'Content-Transfer-Encoding' => 'binary', |
93 | 93 | 'Pragma' => 'public', |
94 | - 'Expires' => Carbon::createFromTimestamp(time()+3600)->toRfc2822String(), |
|
94 | + 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), |
|
95 | 95 | 'Last-Modified' => $imageMeta->updated_at->toRfc2822String(), |
96 | 96 | 'Etag' => $imageMeta->image_etag, |
97 | 97 | ); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | /** |
100 | 100 | * Response code cached |
101 | 101 | */ |
102 | - if( (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag) |
|
103 | - || (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) ){ |
|
102 | + if ((isset($_SERVER[ 'HTTP_IF_NONE_MATCH' ]) && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $imageMeta->image_etag) |
|
103 | + || (isset($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ]) && $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] == $imageMeta->updated_at->toRfc2822String())) { |
|
104 | 104 | |
105 | 105 | $responseCode = 304; |
106 | 106 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * Response code not cached, but OK |
110 | 110 | */ |
111 | - else{ |
|
111 | + else { |
|
112 | 112 | |
113 | 113 | $responseCode = 200; |
114 | 114 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return \Illuminate\Database\Eloquent\Builder |
37 | 37 | */ |
38 | - public function scopeFulltextAllColumns(Builder $query){ |
|
38 | + public function scopeFulltextAllColumns(Builder $query) { |
|
39 | 39 | |
40 | 40 | return Helpers::virtualFulltextSearchColumns($query, request('search'), $this->fulltextFields); |
41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return \Illuminate\Database\Eloquent\Builder |
47 | 47 | */ |
48 | - public function scopeOrderByColumns(Builder $query){ |
|
48 | + public function scopeOrderByColumns(Builder $query) { |
|
49 | 49 | |
50 | 50 | return Helpers::orderByColumns($query, $this->defaultOrderBy); |
51 | 51 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function scopeExcludeFromIndex(Builder $query) |
59 | 59 | { |
60 | - return $query->select( array_diff(Schema::getColumnListing($this->table), $this->excludedFromIndex) ); |
|
60 | + return $query->select(array_diff(Schema::getColumnListing($this->table), $this->excludedFromIndex)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function scopeExcludeFromFind(Builder $query) |
69 | 69 | { |
70 | - if(isset($this->excludedFromFind) == TRUE && is_array($this->excludedFromFind) == TRUE){ |
|
71 | - return $query->select( array_diff(Schema::getColumnListing($this->table), $this->excludedFromFind) ); |
|
70 | + if (isset($this->excludedFromFind) == TRUE && is_array($this->excludedFromFind) == TRUE) { |
|
71 | + return $query->select(array_diff(Schema::getColumnListing($this->table), $this->excludedFromFind)); |
|
72 | 72 | } |
73 | - else{ |
|
73 | + else { |
|
74 | 74 | return $query; |
75 | 75 | } |
76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return \Illuminate\Database\Eloquent\Builder |
82 | 82 | */ |
83 | - public function scopeRelationships(Builder $query){ |
|
83 | + public function scopeRelationships(Builder $query) { |
|
84 | 84 | |
85 | 85 | return $query; |
86 | 86 | } |
@@ -90,30 +90,30 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return \Illuminate\Database\Eloquent\Builder |
92 | 92 | */ |
93 | - public function scopeExternalTablesFilter(Builder $query){ |
|
93 | + public function scopeExternalTablesFilter(Builder $query) { |
|
94 | 94 | |
95 | - if(Request::input('relation')){ |
|
95 | + if (Request::input('relation')) { |
|
96 | 96 | |
97 | - $allTables = []; |
|
97 | + $allTables = [ ]; |
|
98 | 98 | |
99 | 99 | $relations = explode(',', Request::input('relation')); |
100 | 100 | |
101 | - foreach ($relations as $relation){ |
|
101 | + foreach ($relations as $relation) { |
|
102 | 102 | |
103 | 103 | $keyvalue = explode(':', $relation); |
104 | 104 | |
105 | - $key = trim($keyvalue[0]); |
|
106 | - $value = trim($keyvalue[1]); |
|
105 | + $key = trim($keyvalue[ 0 ]); |
|
106 | + $value = trim($keyvalue[ 1 ]); |
|
107 | 107 | |
108 | - $allTables[$key] = $value; |
|
108 | + $allTables[ $key ] = $value; |
|
109 | 109 | |
110 | - if(is_numeric($value) == TRUE){ |
|
110 | + if (is_numeric($value) == TRUE) { |
|
111 | 111 | |
112 | - $query->where(strtolower($key)."_id", '=', $value); |
|
112 | + $query->where(strtolower($key) . "_id", '=', $value); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - request()->merge(['external_tables_filter' => $allTables]); |
|
116 | + request()->merge([ 'external_tables_filter' => $allTables ]); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return $query; |
@@ -63,9 +63,9 @@ |
||
63 | 63 | protected function create(array $data) |
64 | 64 | { |
65 | 65 | return User::create([ |
66 | - 'name' => $data['name'], |
|
67 | - 'email' => $data['email'], |
|
68 | - 'password' => bcrypt($data['password']), |
|
66 | + 'name' => $data[ 'name' ], |
|
67 | + 'email' => $data[ 'email' ], |
|
68 | + 'password' => bcrypt($data[ 'password' ]), |
|
69 | 69 | ]); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | public function __construct() |
37 | 37 | { |
38 | - $this->middleware('guest', ['except' => 'logout']); |
|
38 | + $this->middleware('guest', [ 'except' => 'logout' ]); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param Request $request |
41 | 41 | * @return View|void |
42 | 42 | */ |
43 | - public function getHomepage(Request $request){ |
|
43 | + public function getHomepage(Request $request) { |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Load data |
@@ -50,22 +50,22 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Number of users |
52 | 52 | */ |
53 | - $this->_arViewData['users_no'] = User::count() + 135000; |
|
53 | + $this->_arViewData[ 'users_no' ] = User::count() + 135000; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Number of campaigns |
57 | 57 | */ |
58 | - $this->_arViewData['campaigns_no'] = Campaign::count(); |
|
58 | + $this->_arViewData[ 'campaigns_no' ] = Campaign::count(); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Number of payments total |
62 | 62 | */ |
63 | - $this->_arViewData['payments_no_total'] = Payment::sum('amount'); |
|
63 | + $this->_arViewData[ 'payments_no_total' ] = Payment::sum('amount'); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Number of payments last month |
67 | 67 | */ |
68 | - $this->_arViewData['payments_no_last_month'] = Payment::where('created_at', '>=', Carbon::now()->subMonth())->count(); |
|
68 | + $this->_arViewData[ 'payments_no_last_month' ] = Payment::where('created_at', '>=', Carbon::now()->subMonth())->count(); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Return view |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param Request $request |
80 | 80 | * @return View|void |
81 | 81 | */ |
82 | - public function getContact(Request $request){ |
|
82 | + public function getContact(Request $request) { |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Clear sessions |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | * @param Request $request |
104 | 104 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
105 | 105 | */ |
106 | - public function registerEmail(Request $request){ |
|
106 | + public function registerEmail(Request $request) { |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Validate |
110 | 110 | */ |
111 | - if(env('RECAPTCHA_ENABLED') == 1){ |
|
111 | + if (env('RECAPTCHA_ENABLED') == 1) { |
|
112 | 112 | $this->validate($request, [ |
113 | 113 | 'email' => 'email|required|max:255', |
114 | 114 | 'g-recaptcha-response' => 'required|recaptcha' |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * User not exists |
145 | 145 | */ |
146 | - if(empty($user)){ |
|
146 | + if (empty($user)) { |
|
147 | 147 | |
148 | 148 | $login = $email; |
149 | 149 | $password = str_random(10); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * Save recommendation |
161 | 161 | */ |
162 | - if(Cache::has('recommendation_id')){ |
|
162 | + if (Cache::has('recommendation_id')) { |
|
163 | 163 | |
164 | 164 | $recommendation_id = Cache::get('recommendation_id'); |
165 | 165 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * If not , add to user |
179 | 179 | */ |
180 | - if(empty($test)){ |
|
180 | + if (empty($test)) { |
|
181 | 181 | $user->recommendation_id = $recommendation_id; |
182 | 182 | |
183 | 183 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * Send e-mail |
190 | 190 | */ |
191 | - Mail::send(['emails.html.registration', 'emails.plain.registration'], [ |
|
191 | + Mail::send([ 'emails.html.registration', 'emails.plain.registration' ], [ |
|
192 | 192 | 'user' => $user, |
193 | 193 | 'login' => $login, |
194 | 194 | 'password' => $password, |
195 | 195 | 'activation_code' => $activation_code |
196 | 196 | |
197 | - ], function ($message) { |
|
197 | + ], function($message) { |
|
198 | 198 | $message->from(env('MAIL_FROM_EMAIL', '[email protected]'), env('MAIL_FROM_NAME', 'Surimail.cz')); |
199 | 199 | $message->to(request('email'), request('email')); |
200 | 200 | $message->subject('Registrace na serveru Surimail.cz'); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | /** |
208 | 208 | * User exists - error |
209 | 209 | */ |
210 | - else{ |
|
210 | + else { |
|
211 | 211 | |
212 | 212 | $request->session()->flash('custom_error', 'Zadaný e-mail nebo IP již existuje'); |
213 | 213 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @param Request $request |
224 | 224 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
225 | 225 | */ |
226 | - public function checkActivationCode($email, $activationCode, Request $request){ |
|
226 | + public function checkActivationCode($email, $activationCode, Request $request) { |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Check if user exists |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * User not exists or code is not valid |
235 | 235 | */ |
236 | - if(empty($user)){ |
|
236 | + if (empty($user)) { |
|
237 | 237 | $request->session()->flash('custom_error', 'Zadaný e-mail neexistuje nebo je neplatný aktivační kód'); |
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
241 | 241 | * User exists - activate him |
242 | 242 | */ |
243 | - else{ |
|
243 | + else { |
|
244 | 244 | $user->active = true; |
245 | 245 | $user->activation_code = str_random(16); |
246 | 246 | $user->save(); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * Add reward for registration |
250 | 250 | */ |
251 | 251 | $rewardsCount = Transaction::where('transactionstatus_id', 5)->where('user_id', $user->id)->count(); |
252 | - if($rewardsCount < 1){ |
|
252 | + if ($rewardsCount < 1) { |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Save transaction |
@@ -261,25 +261,25 @@ discard block |
||
261 | 261 | * Add reward for recommedation |
262 | 262 | */ |
263 | 263 | |
264 | - if(!empty($user->recomendation_id) ){ |
|
264 | + if (!empty($user->recomendation_id)) { |
|
265 | 265 | |
266 | 266 | $recommendation = Recommendation::find($user->reccomendation_id); |
267 | 267 | |
268 | - if(!empty($recommendation)){ |
|
268 | + if (!empty($recommendation)) { |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Check transaction |
272 | 272 | */ |
273 | 273 | $transactionCount = Transaction::where('recommendation_id', $recommendation->id)->count(); |
274 | 274 | |
275 | - if($transactionCount < 1){ |
|
275 | + if ($transactionCount < 1) { |
|
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Find user and save money |
279 | 279 | */ |
280 | 280 | $rUser = User::find($recommendation->user_id); |
281 | 281 | |
282 | - if(!empty($rUser)){ |
|
282 | + if (!empty($rUser)) { |
|
283 | 283 | |
284 | 284 | $this->_saveTransation(2, $rUser->id, $this->_getSettings(2)); |
285 | 285 | } |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | $request->session()->flash('success', 'Gratulujeme, váš účet byl úspěšně aktivován. Přihlásit se můžete zde: ' |
291 | - . '<br><a href="'.route('admin.dashboard.index').'">'.route('admin.dashboard.index').'</a>'); |
|
291 | + . '<br><a href="' . route('admin.dashboard.index') . '">' . route('admin.dashboard.index') . '</a>'); |
|
292 | 292 | |
293 | 293 | /** |
294 | 294 | * Save reward |
295 | 295 | */ |
296 | - if($user->recommendation_id != null && $user->recommendation_id > 0){ |
|
296 | + if ($user->recommendation_id != null && $user->recommendation_id > 0) { |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Load recommendation |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param Request $request |
315 | 315 | * @return View|void |
316 | 316 | */ |
317 | - public function index($pageUrl, Request $request){ |
|
317 | + public function index($pageUrl, Request $request) { |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Clear sessions |
@@ -339,19 +339,19 @@ discard block |
||
339 | 339 | * @param Request $request |
340 | 340 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
341 | 341 | */ |
342 | - public function checkRecommmendation($id, Request $request){ |
|
342 | + public function checkRecommmendation($id, Request $request) { |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * @todo Use validator |
346 | 346 | */ |
347 | - if(is_numeric($id)){ |
|
347 | + if (is_numeric($id)) { |
|
348 | 348 | |
349 | 349 | $recommendation = Recommendation::find($id); |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * If exists, than remember |
353 | 353 | */ |
354 | - if(!empty($recommendation)){ |
|
354 | + if (!empty($recommendation)) { |
|
355 | 355 | Cache::forever('recommendation_id', $id); |
356 | 356 | } |
357 | 357 | } |