@@ -15,12 +15,12 @@ |
||
15 | 15 | public static function list($perPage, $condition = []) |
16 | 16 | { |
17 | 17 | $data = Template::query() |
18 | - ->where(function ($query) use ($condition) { |
|
18 | + ->where(function($query) use ($condition) { |
|
19 | 19 | Searchable::buildQuery($query, $condition); |
20 | 20 | }) |
21 | 21 | ->orderBy('id', 'desc') |
22 | 22 | ->paginate($perPage); |
23 | - $data->transform(function ($item) { |
|
23 | + $data->transform(function($item) { |
|
24 | 24 | xssFilter($item); |
25 | 25 | $item->editUrl = route('admin::template.edit', ['id' => $item->id]); |
26 | 26 | $item->deleteUrl = route('admin::template.delete', ['id' => $item->id]); |
@@ -16,12 +16,12 @@ |
||
16 | 16 | public static function list($perPage, $condition = []) |
17 | 17 | { |
18 | 18 | $data = Entity::query() |
19 | - ->where(function ($query) use ($condition) { |
|
19 | + ->where(function($query) use ($condition) { |
|
20 | 20 | Searchable::buildQuery($query, $condition); |
21 | 21 | }) |
22 | 22 | ->orderBy('id', 'desc') |
23 | 23 | ->paginate($perPage); |
24 | - $data->transform(function ($item) { |
|
24 | + $data->transform(function($item) { |
|
25 | 25 | xssFilter($item); |
26 | 26 | $item->editUrl = route('admin::entity.edit', ['id' => $item->id]); |
27 | 27 | $item->deleteUrl = route('admin::entity.delete', ['id' => $item->id]); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | public static function list($perPage = 10, $condition = []) |
14 | 14 | { |
15 | 15 | $data = Comment::query() |
16 | - ->where(function ($query) use ($condition) { |
|
16 | + ->where(function($query) use ($condition) { |
|
17 | 17 | Searchable::buildQuery($query, $condition); |
18 | 18 | }) |
19 | 19 | ->orderBy('id', 'desc') |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | return $data; |
25 | 25 | } |
26 | 26 | |
27 | - $data->transform(function ($item) use ($perPage) { |
|
27 | + $data->transform(function($item) use ($perPage) { |
|
28 | 28 | // 获取评论回复 |
29 | 29 | $reply = self::reply($item->id, $perPage); |
30 | 30 | $item->reply = $reply; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public static function reply($id, $perPage = 10) |
37 | 37 | { |
38 | - return Cache::rememberForever('comment_replay:' . $id, function () use ($id, $perPage) { |
|
38 | + return Cache::rememberForever('comment_replay:' . $id, function() use ($id, $perPage) { |
|
39 | 39 | return Comment::query()->where('rid', $id)->orderBy('id', 'desc')->paginate($perPage); |
40 | 40 | }); |
41 | 41 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public static function neutral(int $id, int $uid) |
56 | 56 | { |
57 | - DB::transaction(function () use ($id, $uid) { |
|
57 | + DB::transaction(function() use ($id, $uid) { |
|
58 | 58 | $logs = CommentOperateLog::query()->select('operate')-> |
59 | 59 | where('user_id', $uid)->where('comment_id', $id)->get(); |
60 | 60 | if ($logs->isEmpty()) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public static function operate(int $id, int $uid, string $operate) |
80 | 80 | { |
81 | - return DB::transaction(function () use ($id, $uid, $operate) { |
|
81 | + return DB::transaction(function() use ($id, $uid, $operate) { |
|
82 | 82 | $log = CommentOperateLog::query()->where('user_id', $uid)->where('comment_id', $id) |
83 | 83 | ->where('operate', $operate)->first(); |
84 | 84 | if ($log) { |
@@ -22,7 +22,7 @@ |
||
22 | 22 | list($type, $value) = $v; |
23 | 23 | } |
24 | 24 | $value = trim($value); |
25 | - if ($type ==='like' && $value === '') { |
|
25 | + if ($type === 'like' && $value === '') { |
|
26 | 26 | continue; |
27 | 27 | } |
28 | 28 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $guardName = $guardName ?? Guard::getDefaultName(static::class); |
57 | 57 | $permission = static::getPermissions(['name' => $name, 'guard_name' => $guardName])->first(); |
58 | - if (! $permission) { |
|
58 | + if (!$permission) { |
|
59 | 59 | throw PermissionDoesNotExist::create($name, $guardName); |
60 | 60 | } |
61 | 61 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $guardName = $guardName ?? Guard::getDefaultName(static::class); |
71 | 71 | $permission = static::getPermissions(['id' => $id, 'guard_name' => $guardName])->first(); |
72 | 72 | |
73 | - if (! $permission) { |
|
73 | + if (!$permission) { |
|
74 | 74 | throw PermissionDoesNotExist::withId($id); |
75 | 75 | } |
76 | 76 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $guardName = $guardName ?? Guard::getDefaultName(static::class); |
86 | 86 | $permission = static::getPermissions(['name' => $name, 'guard_name' => $guardName])->first(); |
87 | 87 | |
88 | - if (! $permission) { |
|
88 | + if (!$permission) { |
|
89 | 89 | return static::query()->create(['name' => $name, 'guard_name' => $guardName]); |
90 | 90 | } |
91 | 91 |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | } |
86 | 86 | $that = $this; |
87 | 87 | $indexCode = array(); |
88 | - array_walk($this->indexCode, function ($statistics, &$sensitive) use ($that, &$indexCode) { |
|
88 | + array_walk($this->indexCode, function($statistics, &$sensitive) use ($that, &$indexCode) { |
|
89 | 89 | $sensitive = $that->asciiTransformUtf8($sensitive); |
90 | - $indexCode[ $sensitive ] = $statistics; |
|
90 | + $indexCode[$sensitive] = $statistics; |
|
91 | 91 | }); |
92 | 92 | return $indexCode; |
93 | 93 | } |
94 | 94 | |
95 | 95 | private function exist($sensitive, $statistics = false) |
96 | 96 | { |
97 | - if (isset($this->indexCode[ $sensitive ])) { |
|
98 | - $statistics && $this->indexCode[ $sensitive ]++; |
|
97 | + if (isset($this->indexCode[$sensitive])) { |
|
98 | + $statistics && $this->indexCode[$sensitive]++; |
|
99 | 99 | return true; |
100 | 100 | } else { |
101 | - $this->indexCode[ $sensitive ] = 1; |
|
101 | + $this->indexCode[$sensitive] = 1; |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | } |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | yield $c; |
172 | 172 | } elseif (($n >> 4) == 15) { //1111 xxxx, first in four char |
173 | 173 | if ($i < $len - 3) { |
174 | - yield $c . $str[ $i + 1 ] . $str[ $i + 2 ] . $str[ $i + 3 ]; |
|
174 | + yield $c . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
175 | 175 | $i += 3; |
176 | 176 | } |
177 | 177 | } elseif (($n >> 5) == 7) { |
178 | 178 | //111x xxxx, first in three char |
179 | 179 | if ($i < $len - 2) { |
180 | - yield $c . $str[ $i + 1 ] . $str[ $i + 2 ]; |
|
180 | + yield $c . $str[$i + 1] . $str[$i + 2]; |
|
181 | 181 | $i += 2; |
182 | 182 | } |
183 | 183 | } elseif (($n >> 6) == 3) { |
184 | 184 | //11xx xxxx, first in two char |
185 | 185 | if ($i < $len - 1) { |
186 | - yield $c . $str[ $i + 1 ]; |
|
186 | + yield $c . $str[$i + 1]; |
|
187 | 187 | $i++; |
188 | 188 | } |
189 | 189 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | protected function commands() |
37 | 37 | { |
38 | - $this->load(__DIR__.'/Commands'); |
|
38 | + $this->load(__DIR__ . '/Commands'); |
|
39 | 39 | |
40 | 40 | require base_path('routes/console.php'); |
41 | 41 | } |
@@ -250,7 +250,7 @@ |
||
250 | 250 | 'msg' => '参数错误' |
251 | 251 | ]; |
252 | 252 | } |
253 | - $ids = array_map(function ($item) { |
|
253 | + $ids = array_map(function($item) { |
|
254 | 254 | return intval($item); |
255 | 255 | }, $ids); |
256 | 256 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ]; |
102 | 102 | } |
103 | 103 | |
104 | - Schema::table($table->table_name, function (Blueprint $table) use ($data) { |
|
104 | + Schema::table($table->table_name, function(Blueprint $table) use ($data) { |
|
105 | 105 | $m = $data['type']; |
106 | 106 | $length = intval($data['field_length']); |
107 | 107 | $total = intval($data['field_total']); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | try { |
205 | 205 | $entityField = EntityField::query()->findOrFail($id); |
206 | 206 | $entity = $entityField->entity; |
207 | - Schema::table($entity->table_name, function (Blueprint $table) use ($entityField) { |
|
207 | + Schema::table($entity->table_name, function(Blueprint $table) use ($entityField) { |
|
208 | 208 | $table->dropColumn($entityField->name); |
209 | 209 | }); |
210 | 210 | EntityFieldRepository::delete($id); |