@@ -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 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | - protected $_arViewData = []; |
|
| 34 | + protected $_arViewData = [ ]; |
|
| 35 | 35 | |
| 36 | - protected $_arViewGeneratedData = []; |
|
| 36 | + protected $_arViewGeneratedData = [ ]; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Check if view exists, if so - return, if not throw 404 |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | * @param string $strView |
| 42 | 42 | * @return View|void |
| 43 | 43 | */ |
| 44 | - protected function _showViewOr404($strView){ |
|
| 44 | + protected function _showViewOr404($strView) { |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | if (view()->exists($strView)) { |
| 48 | 48 | return view($strView, $this->_arViewData); |
| 49 | 49 | } |
| 50 | - else{ |
|
| 50 | + else { |
|
| 51 | 51 | return abort(404); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | * Save all inputs to session |
| 57 | 57 | * @param $request |
| 58 | 58 | */ |
| 59 | - protected function _saveSessionFields($request){ |
|
| 59 | + protected function _saveSessionFields($request) { |
|
| 60 | 60 | |
| 61 | - foreach ($request->all() as $key=>$value){ |
|
| 62 | - $arData[$key] = $value; |
|
| 61 | + foreach ($request->all() as $key=>$value) { |
|
| 62 | + $arData[ $key ] = $value; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $request->session()->put('frontend_fields', $arData); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * Reset all session fields |
| 70 | 70 | */ |
| 71 | - protected function _resetSessionFields($request){ |
|
| 71 | + protected function _resetSessionFields($request) { |
|
| 72 | 72 | |
| 73 | 73 | $request->session()->forget('frontend_fields'); |
| 74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param $request |
| 80 | 80 | */ |
| 81 | - protected function _calculatePrice($request){ |
|
| 81 | + protected function _calculatePrice($request) { |
|
| 82 | 82 | |
| 83 | 83 | return 0; |
| 84 | 84 | } |
@@ -89,24 +89,24 @@ discard block |
||
| 89 | 89 | * @param $request |
| 90 | 90 | * @return mixed |
| 91 | 91 | */ |
| 92 | - protected function _getSessionFields($request){ |
|
| 92 | + protected function _getSessionFields($request) { |
|
| 93 | 93 | |
| 94 | 94 | $fields = $request->session()->get('frontend_fields'); |
| 95 | 95 | |
| 96 | - if(isset($request->id)){ |
|
| 96 | + if (isset($request->id)) { |
|
| 97 | 97 | //$fields['price'] = $this->_calculatePrice($request); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(isset($fields['city'])) { |
|
| 101 | - $arCityInfo = explode('|', $fields['city']); |
|
| 100 | + if (isset($fields[ 'city' ])) { |
|
| 101 | + $arCityInfo = explode('|', $fields[ 'city' ]); |
|
| 102 | 102 | |
| 103 | - $fields['citypart'] = @trim($arCityInfo[0]); |
|
| 104 | - $fields['citymain'] = @trim($arCityInfo[1]); |
|
| 105 | - $fields['county'] = @trim($arCityInfo[2]); |
|
| 106 | - $fields['zip'] = @trim($arCityInfo[3]); |
|
| 103 | + $fields[ 'citypart' ] = @trim($arCityInfo[ 0 ]); |
|
| 104 | + $fields[ 'citymain' ] = @trim($arCityInfo[ 1 ]); |
|
| 105 | + $fields[ 'county' ] = @trim($arCityInfo[ 2 ]); |
|
| 106 | + $fields[ 'zip' ] = @trim($arCityInfo[ 3 ]); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $this->_arViewData['fields'] = $fields; |
|
| 109 | + $this->_arViewData[ 'fields' ] = $fields; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param $url |
| 116 | 116 | * @return mixed |
| 117 | 117 | */ |
| 118 | - protected function _loadPageByUrl($url){ |
|
| 118 | + protected function _loadPageByUrl($url) { |
|
| 119 | 119 | |
| 120 | 120 | return Page::where('url', $url)->firstOrFail(); |
| 121 | 121 | } |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | * @param $id |
| 127 | 127 | * @return mixed |
| 128 | 128 | */ |
| 129 | - protected function _loadPageById($id){ |
|
| 129 | + protected function _loadPageById($id) { |
|
| 130 | 130 | return Page::findOrFail($id); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - protected function _getSettings($id){ |
|
| 133 | + protected function _getSettings($id) { |
|
| 134 | 134 | |
| 135 | 135 | $settings = Settings::find($id); |
| 136 | 136 | |
| 137 | - if(!empty($settings)){ |
|
| 138 | - return $settings['value']; |
|
| 137 | + if (!empty($settings)) { |
|
| 138 | + return $settings[ 'value' ]; |
|
| 139 | 139 | } |
| 140 | - else{ |
|
| 140 | + else { |
|
| 141 | 141 | return NULL; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @param $amount |
| 152 | 152 | */ |
| 153 | 153 | protected function _saveTransation($status_id = 1, $user_id, $amount, |
| 154 | - $campaign_id = null, $payment_id = null, $recommendation_id = null){ |
|
| 154 | + $campaign_id = null, $payment_id = null, $recommendation_id = null) { |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Save transaction |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $gaData = []; |
|
| 44 | + protected $gaData = [ ]; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Constructor |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * Module name for blade |
| 59 | 59 | */ |
| 60 | 60 | $temp = explode('.', $this->moduleBasicRoute); |
| 61 | - View::share('moduleNameBlade', $temp[0] . "_module_" . $temp[1]); |
|
| 61 | + View::share('moduleNameBlade', $temp[ 0 ] . "_module_" . $temp[ 1 ]); |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | } |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | $ga = $this->getGAValues(); |
| 79 | 79 | } else { |
| 80 | 80 | |
| 81 | - $ga = []; |
|
| 81 | + $ga = [ ]; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $statistics = [ |
| 85 | 85 | 'ga' => $ga |
| 86 | 86 | ]; |
| 87 | 87 | |
| 88 | - return view('admin.modules.dashboard.index', ['statistics' => $statistics]); |
|
| 88 | + return view('admin.modules.dashboard.index', [ 'statistics' => $statistics ]); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * Get the data |
| 102 | 102 | */ |
| 103 | - $data = \Analytics::getVisitorsAndPageViews($days); |
|
| 103 | + $data = \Analytics::getVisitorsAndPageViews($days); |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Calculate total |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $total = 0; |
| 109 | 109 | foreach ($data as $value) { |
| 110 | 110 | |
| 111 | - $total += $value[$type]; |
|
| 111 | + $total += $value[ $type ]; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return $total; |
@@ -29,13 +29,13 @@ |
||
| 29 | 29 | public function handle(Request $request, Closure $next) |
| 30 | 30 | { |
| 31 | 31 | |
| 32 | - if($request->has('published')){ |
|
| 32 | + if ($request->has('published')) { |
|
| 33 | 33 | |
| 34 | - $request->merge(['published_at' => \Carbon\Carbon::now()]); |
|
| 34 | + $request->merge([ 'published_at' => \Carbon\Carbon::now() ]); |
|
| 35 | 35 | } |
| 36 | - else{ |
|
| 36 | + else { |
|
| 37 | 37 | |
| 38 | - $request->merge(['published_at' => NULL]); |
|
| 38 | + $request->merge([ 'published_at' => NULL ]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | return $next($request); |
@@ -31,15 +31,15 @@ |
||
| 31 | 31 | public function handle(Request $request, Closure $next) |
| 32 | 32 | { |
| 33 | 33 | $intArgs = func_num_args(); |
| 34 | - for($a = 2; $a < $intArgs; $a++){ |
|
| 34 | + for ($a = 2; $a < $intArgs; $a++) { |
|
| 35 | 35 | |
| 36 | 36 | $model = func_get_arg($a); |
| 37 | - $modelWithNamespace = 'App\\'.$model; |
|
| 37 | + $modelWithNamespace = 'App\\' . $model; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - $array = ['other_tables' => |
|
| 40 | + $array = [ 'other_tables' => |
|
| 41 | 41 | [ |
| 42 | - $model => $modelWithNamespace::orderBy('id', 'desc')->get(['id', 'name', 'url', 'image_extension']) |
|
| 42 | + $model => $modelWithNamespace::orderBy('id', 'desc')->get([ 'id', 'name', 'url', 'image_extension' ]) |
|
| 43 | 43 | ] |
| 44 | 44 | ]; |
| 45 | 45 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function __construct() { |
| 28 | 28 | parent::__construct(); |
| 29 | 29 | |
| 30 | - $this->middleware('add.lookup.tables:ImageCategory', ['only' => ['index','create','edit']]); |
|
| 30 | + $this->middleware('add.lookup.tables:ImageCategory', [ 'only' => [ 'index', 'create', 'edit' ] ]); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @var array |
| 47 | 47 | */ |
| 48 | - protected $binaryFields = []; |
|
| 48 | + protected $binaryFields = [ ]; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Get number of pagination rows |
| 52 | 52 | * |
| 53 | 53 | * @return integer |
| 54 | 54 | */ |
| 55 | - public function getRowsToPaginate(){ |
|
| 55 | + public function getRowsToPaginate() { |
|
| 56 | 56 | |
| 57 | 57 | return env('ADMIN_MEDIA_PAGINATE', 12); |
| 58 | 58 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param object $object |
| 64 | 64 | * @param Request $request |
| 65 | 65 | */ |
| 66 | - public function associateRelationships($object, Request $request){ |
|
| 66 | + public function associateRelationships($object, Request $request) { |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Validate category ID, if failed set to default |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * Validator OK - save it |
| 85 | 85 | */ |
| 86 | - else{ |
|
| 86 | + else { |
|
| 87 | 87 | |
| 88 | 88 | $object->imagecategories()->associate($request->input('imagecategory_id')); |
| 89 | 89 | } |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Image has an url |
| 109 | 109 | */ |
| 110 | - if(strlen($request->input('url') > 5)){ |
|
| 110 | + if (strlen($request->input('url') > 5)) { |
|
| 111 | 111 | $object->addMedia($request->file('image'))->toMediaCollection('images') |
| 112 | 112 | ->usingName($request->input('url')); |
| 113 | 113 | } |
| 114 | - else{ |
|
| 114 | + else { |
|
| 115 | 115 | $object->addMedia($request->file('image'))->toMediaCollection('images'); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Get META information |
| 42 | 42 | */ |
| 43 | - $imageMeta = Image::where(['url' => $request->imageName])->first(); |
|
| 43 | + $imageMeta = Image::where([ 'url' => $request->imageName ])->first(); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * File does not exist |
| 47 | 47 | */ |
| 48 | - if(empty($imageMeta) == TRUE){ |
|
| 48 | + if (empty($imageMeta) == TRUE) { |
|
| 49 | 49 | App::abort(404); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $mediaItems = $imageMeta->getMedia(); |
| 53 | - $fullPathOnDisk = $mediaItems[0]->getPath(); |
|
| 53 | + $fullPathOnDisk = $mediaItems[ 0 ]->getPath(); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | 'Content-Description' => 'File Transfer', |
| 67 | 67 | 'Content-Transfer-Encoding' => 'binary', |
| 68 | 68 | 'Pragma' => 'public', |
| 69 | - 'Expires' => Carbon::createFromTimestamp(time()+3600)->toRfc2822String(), |
|
| 69 | + 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), |
|
| 70 | 70 | 'Last-Modified' => $imageMeta->updated_at->toRfc2822String() |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * Response code cached |
| 75 | 75 | */ |
| 76 | - if( (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag) |
|
| 77 | - || (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) ){ |
|
| 76 | + if ((isset($_SERVER[ 'HTTP_IF_NONE_MATCH' ]) && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $imageMeta->image_etag) |
|
| 77 | + || (isset($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ]) && $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] == $imageMeta->updated_at->toRfc2822String())) { |
|
| 78 | 78 | |
| 79 | 79 | $responseCode = 304; |
| 80 | 80 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Response code not cached, but OK |
| 84 | 84 | */ |
| 85 | - else{ |
|
| 85 | + else { |
|
| 86 | 86 | |
| 87 | 87 | $responseCode = 200; |
| 88 | 88 | } |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Root |
| 17 | 17 | */ |
| 18 | -Route::get('/', ['as' => 'root', function () { |
|
| 18 | +Route::get('/', [ 'as' => 'root', function() { |
|
| 19 | 19 | return view('welcome'); |
| 20 | -}]); |
|
| 20 | +} ]); |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Main index |
| 24 | 24 | */ |
| 25 | -Route::get('/home', function () { |
|
| 25 | +Route::get('/home', function() { |
|
| 26 | 26 | |
| 27 | 27 | return redirect()->route('admin.dashboard.index'); |
| 28 | 28 | }); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * Admin |
| 32 | 32 | */ |
| 33 | -Route::group(['prefix' => env('APP_ADMIN_URL', 'admin'), 'as' => 'admin.', 'middleware' => ['web', 'auth']], function () { |
|
| 33 | +Route::group([ 'prefix' => env('APP_ADMIN_URL', 'admin'), 'as' => 'admin.', 'middleware' => [ 'web', 'auth' ] ], function() { |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | /** |
| 44 | 44 | * Articles and categories |
| 45 | 45 | */ |
| 46 | - Route::resource('page', 'Admin\PageController', ['names' => [ |
|
| 46 | + Route::resource('page', 'Admin\PageController', [ 'names' => [ |
|
| 47 | 47 | 'index' => 'page.index', |
| 48 | 48 | 'create' => 'page.create', |
| 49 | 49 | 'store' => 'page.store', |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | 'edit' => 'page.edit', |
| 52 | 52 | 'update' => 'page.update', |
| 53 | 53 | 'destroy' => 'page.destroy' |
| 54 | - ]]); |
|
| 55 | - Route::resource('pageCategory', 'Admin\PageCategoryController', ['names' => [ |
|
| 54 | + ] ]); |
|
| 55 | + Route::resource('pageCategory', 'Admin\PageCategoryController', [ 'names' => [ |
|
| 56 | 56 | 'index' => 'pageCategory.index', |
| 57 | 57 | 'create' => 'pageCategory.create', |
| 58 | 58 | 'store' => 'pageCategory.store', |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | 'edit' => 'pageCategory.edit', |
| 61 | 61 | 'update' => 'pageCategory.update', |
| 62 | 62 | 'destroy' => 'pageCategory.destroy' |
| 63 | - ]]); |
|
| 63 | + ] ]); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Articles and categories |
| 67 | 67 | */ |
| 68 | - Route::resource('article', 'Admin\ArticleController', ['names' => [ |
|
| 68 | + Route::resource('article', 'Admin\ArticleController', [ 'names' => [ |
|
| 69 | 69 | 'index' => 'article.index', |
| 70 | 70 | 'create' => 'article.create', |
| 71 | 71 | 'store' => 'article.store', |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | 'edit' => 'article.edit', |
| 74 | 74 | 'update' => 'article.update', |
| 75 | 75 | 'destroy' => 'article.destroy' |
| 76 | - ]]); |
|
| 77 | - Route::resource('articleCategory', 'Admin\ArticleCategoryController', ['names' => [ |
|
| 76 | + ] ]); |
|
| 77 | + Route::resource('articleCategory', 'Admin\ArticleCategoryController', [ 'names' => [ |
|
| 78 | 78 | 'index' => 'articleCategory.index', |
| 79 | 79 | 'create' => 'articleCategory.create', |
| 80 | 80 | 'store' => 'articleCategory.store', |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | 'edit' => 'articleCategory.edit', |
| 83 | 83 | 'update' => 'articleCategory.update', |
| 84 | 84 | 'destroy' => 'articleCategory.destroy' |
| 85 | - ]]); |
|
| 85 | + ] ]); |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Feedback |
| 89 | 89 | */ |
| 90 | - Route::resource('feedback', 'Admin\FeedbackController', ['names' => [ |
|
| 90 | + Route::resource('feedback', 'Admin\FeedbackController', [ 'names' => [ |
|
| 91 | 91 | 'index' => 'feedback.index', |
| 92 | 92 | 'create' => 'feedback.create', |
| 93 | 93 | 'store' => 'feedback.store', |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | 'edit' => 'feedback.edit', |
| 96 | 96 | 'update' => 'feedback.update', |
| 97 | 97 | 'destroy' => 'feedback.destroy' |
| 98 | - ]]); |
|
| 98 | + ] ]); |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Comment |
| 102 | 102 | */ |
| 103 | - Route::resource('comment', 'Admin\CommentController', ['names' => [ |
|
| 103 | + Route::resource('comment', 'Admin\CommentController', [ 'names' => [ |
|
| 104 | 104 | 'index' => 'comment.index', |
| 105 | 105 | 'create' => 'comment.create', |
| 106 | 106 | 'store' => 'comment.store', |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | 'edit' => 'comment.edit', |
| 109 | 109 | 'update' => 'comment.update', |
| 110 | 110 | 'destroy' => 'comment.destroy' |
| 111 | - ]]); |
|
| 111 | + ] ]); |
|
| 112 | 112 | Route::get('comment/{id}/approve', [ |
| 113 | 113 | 'as' => 'comment.approve', 'uses' => 'Admin\CommentController@approve' |
| 114 | 114 | ]); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * Sliders and slides |
| 121 | 121 | */ |
| 122 | - Route::resource('slider', 'Admin\SliderController', ['names' => [ |
|
| 122 | + Route::resource('slider', 'Admin\SliderController', [ 'names' => [ |
|
| 123 | 123 | 'index' => 'slider.index', |
| 124 | 124 | 'create' => 'slider.create', |
| 125 | 125 | 'store' => 'slider.store', |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | 'edit' => 'slider.edit', |
| 128 | 128 | 'update' => 'slider.update', |
| 129 | 129 | 'destroy' => 'slider.destroy' |
| 130 | - ]]); |
|
| 131 | - Route::resource('slide', 'Admin\SlideController', ['names' => [ |
|
| 130 | + ] ]); |
|
| 131 | + Route::resource('slide', 'Admin\SlideController', [ 'names' => [ |
|
| 132 | 132 | 'index' => 'slide.index', |
| 133 | 133 | 'create' => 'slide.create', |
| 134 | 134 | 'store' => 'slide.store', |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | 'edit' => 'slide.edit', |
| 137 | 137 | 'update' => 'slide.update', |
| 138 | 138 | 'destroy' => 'slide.destroy' |
| 139 | - ]]); |
|
| 139 | + ] ]); |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * Images and categories |
| 143 | 143 | */ |
| 144 | - Route::resource('image', 'Admin\ImageController', ['names' => [ |
|
| 144 | + Route::resource('image', 'Admin\ImageController', [ 'names' => [ |
|
| 145 | 145 | 'index' => 'image.index', |
| 146 | 146 | 'create' => 'image.create', |
| 147 | 147 | 'store' => 'image.store', |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | 'edit' => 'image.edit', |
| 150 | 150 | 'update' => 'image.update', |
| 151 | 151 | 'destroy' => 'image.destroy' |
| 152 | - ]]); |
|
| 153 | - Route::resource('imageCategory', 'Admin\ImageCategoryController', ['names' => [ |
|
| 152 | + ] ]); |
|
| 153 | + Route::resource('imageCategory', 'Admin\ImageCategoryController', [ 'names' => [ |
|
| 154 | 154 | 'index' => 'imageCategory.index', |
| 155 | 155 | 'create' => 'imageCategory.create', |
| 156 | 156 | 'store' => 'imageCategory.store', |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | 'edit' => 'imageCategory.edit', |
| 159 | 159 | 'update' => 'imageCategory.update', |
| 160 | 160 | 'destroy' => 'imageCategory.destroy' |
| 161 | - ]]); |
|
| 161 | + ] ]); |
|
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Advertising |
| 165 | 165 | */ |
| 166 | - Route::resource('advert', 'Admin\AdvertController', ['names' => [ |
|
| 166 | + Route::resource('advert', 'Admin\AdvertController', [ 'names' => [ |
|
| 167 | 167 | 'index' => 'advert.index', |
| 168 | 168 | 'create' => 'advert.create', |
| 169 | 169 | 'store' => 'advert.store', |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | 'edit' => 'advert.edit', |
| 172 | 172 | 'update' => 'advert.update', |
| 173 | 173 | 'destroy' => 'advert.destroy' |
| 174 | - ]]); |
|
| 175 | - Route::resource('advertLocation', 'Admin\AdvertLocationController', ['names' => [ |
|
| 174 | + ] ]); |
|
| 175 | + Route::resource('advertLocation', 'Admin\AdvertLocationController', [ 'names' => [ |
|
| 176 | 176 | 'index' => 'advertLocation.index', |
| 177 | 177 | 'create' => 'advertLocation.create', |
| 178 | 178 | 'store' => 'advertLocation.store', |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | 'edit' => 'advertLocation.edit', |
| 181 | 181 | 'update' => 'advertLocation.update', |
| 182 | 182 | 'destroy' => 'advertLocation.destroy' |
| 183 | - ]]); |
|
| 183 | + ] ]); |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * Products and categories |
| 187 | 187 | */ |
| 188 | - Route::resource('productCategory', 'Admin\ProductCategoryController', ['names' => [ |
|
| 188 | + Route::resource('productCategory', 'Admin\ProductCategoryController', [ 'names' => [ |
|
| 189 | 189 | 'index' => 'productCategory.index', |
| 190 | 190 | 'create' => 'productCategory.create', |
| 191 | 191 | 'store' => 'productCategory.store', |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | 'edit' => 'productCategory.edit', |
| 194 | 194 | 'update' => 'productCategory.update', |
| 195 | 195 | 'destroy' => 'productCategory.destroy' |
| 196 | - ]]); |
|
| 197 | - Route::resource('product', 'Admin\ProductController', ['names' => [ |
|
| 196 | + ] ]); |
|
| 197 | + Route::resource('product', 'Admin\ProductController', [ 'names' => [ |
|
| 198 | 198 | 'index' => 'product.index', |
| 199 | 199 | 'create' => 'product.create', |
| 200 | 200 | 'store' => 'product.store', |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | 'edit' => 'product.edit', |
| 203 | 203 | 'update' => 'product.update', |
| 204 | 204 | 'destroy' => 'product.destroy' |
| 205 | - ]]); |
|
| 205 | + ] ]); |
|
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * Settings |
| 209 | 209 | */ |
| 210 | 210 | Route::resource('settings', 'Admin\SettingsController', [ |
| 211 | - 'except' => ['delete', 'show'], |
|
| 211 | + 'except' => [ 'delete', 'show' ], |
|
| 212 | 212 | 'names' => [ |
| 213 | 213 | 'index' => 'settings.index', |
| 214 | 214 | 'create' => 'settings.create', |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | 'edit' => 'settings.edit', |
| 218 | 218 | 'update' => 'settings.update', |
| 219 | 219 | 'destroy' => 'settings.destroy' |
| 220 | - ]]); |
|
| 220 | + ] ]); |
|
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Users |
| 224 | 224 | */ |
| 225 | 225 | Route::resource('user', 'Admin\UserController', [ |
| 226 | - 'except' => ['show'], |
|
| 226 | + 'except' => [ 'show' ], |
|
| 227 | 227 | 'names' => [ |
| 228 | 228 | 'index' => 'user.index', |
| 229 | 229 | 'create' => 'user.create', |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | 'edit' => 'user.edit', |
| 233 | 233 | 'update' => 'user.update', |
| 234 | 234 | 'destroy' => 'user.destroy' |
| 235 | - ]]); |
|
| 235 | + ] ]); |
|
| 236 | 236 | |
| 237 | 237 | }); |
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Authentication |
| 241 | 241 | */ |
| 242 | -Route::group(['middleware' => 'web'], function () { |
|
| 242 | +Route::group([ 'middleware' => 'web' ], function() { |
|
| 243 | 243 | |
| 244 | 244 | Route::get('login', 'Auth\LoginController@showLoginForm')->name('login'); |
| 245 | 245 | Route::post('login', 'Auth\LoginController@login')->name('authPostLogin'); |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Frontend root |
| 17 | 17 | */ |
| 18 | -Route::get('/', ['as' => 'root', function () { |
|
| 18 | +Route::get('/', [ 'as' => 'root', function() { |
|
| 19 | 19 | return view('welcome'); |
| 20 | -}]); |
|
| 20 | +} ]); |
|