@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * with this source code in the file LICENSE. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if (! function_exists('flash')) { |
|
| 12 | +if (!function_exists('flash')) { |
|
| 13 | 13 | function flash($message, $level = 'warning') |
| 14 | 14 | { |
| 15 | 15 | $message = new \Illuminate\Support\MessageBag([$level => $message]); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (! function_exists('get_first_flash')) { |
|
| 20 | +if (!function_exists('get_first_flash')) { |
|
| 21 | 21 | /** |
| 22 | 22 | * 获取第一条FLASH信息. |
| 23 | 23 | * |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function get_first_flash($level) |
| 29 | 29 | { |
| 30 | - if (! session()->has($level)) { |
|
| 30 | + if (!session()->has($level)) { |
|
| 31 | 31 | return ''; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -if (! function_exists('menu_is_active')) { |
|
| 38 | +if (!function_exists('menu_is_active')) { |
|
| 39 | 39 | /** |
| 40 | 40 | * 指定路由名是否与当前访问的路由名相同. |
| 41 | 41 | * |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $routeName = strtolower($routeName); |
| 49 | 49 | $currentRouteName = strtolower(request()->route()->getName()); |
| 50 | 50 | $isActive = $currentRouteName === $routeName ? 'active' : ''; |
| 51 | - if (! $isActive && str_contains('.', $currentRouteName)) { |
|
| 51 | + if (!$isActive && str_contains('.', $currentRouteName)) { |
|
| 52 | 52 | $currentRouteNameArray = explode('.', $currentRouteName); |
| 53 | 53 | unset($currentRouteNameArray[count($currentRouteNameArray) - 1]); |
| 54 | 54 | $currentRouteName = implode('.', $currentRouteNameArray); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -if (! function_exists('exception_response')) { |
|
| 62 | +if (!function_exists('exception_response')) { |
|
| 63 | 63 | /** |
| 64 | 64 | * 异常响应. |
| 65 | 65 | * |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | -if (! function_exists('notification_name')) { |
|
| 80 | +if (!function_exists('notification_name')) { |
|
| 81 | 81 | /** |
| 82 | 82 | * 获取Notification模板名. |
| 83 | 83 | * |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('at_user')) { |
|
| 97 | +if (!function_exists('at_user')) { |
|
| 98 | 98 | /** |
| 99 | 99 | * 艾特某个用户. |
| 100 | 100 | * |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | function at_user($content, $fromUser, $from, $fromType) |
| 107 | 107 | { |
| 108 | 108 | preg_match_all('/\s{1}@(.*?)\s{1}/', $content, $result); |
| 109 | - if (! ($result = optional($result)[1])) { |
|
| 109 | + if (!($result = optional($result)[1])) { |
|
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | foreach ($result as $item) { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | -if (! function_exists('at_notification_parse')) { |
|
| 118 | +if (!function_exists('at_notification_parse')) { |
|
| 119 | 119 | /** |
| 120 | 120 | * 艾特Notification内容输出. |
| 121 | 121 | * |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | -if (! function_exists('exception_record')) { |
|
| 146 | +if (!function_exists('exception_record')) { |
|
| 147 | 147 | /** |
| 148 | 148 | * 记录异常. |
| 149 | 149 | * |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | -if (! function_exists('admin')) { |
|
| 164 | +if (!function_exists('admin')) { |
|
| 165 | 165 | /** |
| 166 | 166 | * 获取当前登录的管理员. |
| 167 | 167 | * |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | public function index() |
| 23 | 23 | { |
| 24 | - $courses = Cache::remember('index_recent_course', 360, function () { |
|
| 24 | + $courses = Cache::remember('index_recent_course', 360, function() { |
|
| 25 | 25 | return Course::published()->show()->orderByDesc('created_at')->limit(3)->get(); |
| 26 | 26 | }); |
| 27 | - $roles = Cache::remember('index_roles', 360, function () { |
|
| 27 | + $roles = Cache::remember('index_roles', 360, function() { |
|
| 28 | 28 | return Role::orderByDesc('weight')->limit(3)->get(); |
| 29 | 29 | }); |
| 30 | 30 | ['title' => $title, 'keywords' => $keywords, 'description' => $description] = config('meedu.seo.index'); |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | public function subscriptionHandler(Request $request) |
| 36 | 36 | { |
| 37 | 37 | $email = $request->input('email', ''); |
| 38 | - if (! $email) { |
|
| 38 | + if (!$email) { |
|
| 39 | 39 | flash('请输入邮箱', 'warning'); |
| 40 | 40 | |
| 41 | 41 | return back(); |
| 42 | 42 | } |
| 43 | 43 | $exists = EmailSubscription::whereEmail($email)->exists(); |
| 44 | - if (! $exists) { |
|
| 44 | + if (!$exists) { |
|
| 45 | 45 | EmailSubscription::create(compact('email')); |
| 46 | 46 | } |
| 47 | 47 | flash('订阅成功', 'success'); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | { |
| 42 | 42 | [$oldPassword, $newPassword] = $request->filldata(); |
| 43 | 43 | $user = Auth::user(); |
| 44 | - if (! Hash::check($oldPassword, $user->password)) { |
|
| 44 | + if (!Hash::check($oldPassword, $user->password)) { |
|
| 45 | 45 | flash('原密码不正确'); |
| 46 | 46 | |
| 47 | 47 | return back(); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | $rows = []; |
| 29 | 29 | foreach ($request->all() as $index => $item) { |
| 30 | - if (! preg_match('/\*/', $index)) { |
|
| 30 | + if (!preg_match('/\*/', $index)) { |
|
| 31 | 31 | continue; |
| 32 | 32 | } |
| 33 | 33 | $index = str_replace('*', '.', $index); |