From 581be76769864559c73c7207b8da1b021a18c481 Mon Sep 17 00:00:00 2001 From: AmazonPython Date: Sun, 21 Nov 2021 18:51:32 +0800 Subject: [PATCH 1/2] Updated .styleci.yml file. --- .styleci.yml | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index 221b26c..324f853 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,19 +1,16 @@ -php: - risky: false - version: 7.4 - preset: recommended - tab-width: 4 - use-tabs: true - finder: - exclude: - - "modules" - - "node_modules" - - "nova" - - "nova-components" - - "storage" - - "spark" - - "vendor" - name: "*.php" - not-name: - - "*.blade.php" - - "_ide_helper.php" +risky: false +version: 7.4 +preset: recommended +finder: + exclude: + - "modules" + - "node_modules" + - "nova" + - "nova-components" + - "storage" + - "spark" + - "vendor" + name: "*.php" + not-name: + - "*.blade.php" + - "_ide_helper.php" From a28d1c24025c315e87954e028c3e787177e41be2 Mon Sep 17 00:00:00 2001 From: Nova Date: Sun, 21 Nov 2021 10:52:27 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- app/Channel.php | 2 +- app/Console/Kernel.php | 3 +- app/Events/ThreadReceivedNewReply.php | 8 +- app/Exceptions/Handler.php | 8 +- app/Extensions/EloquentUserProvider.php | 5 +- app/Favoritable.php | 6 +- app/Filters/Filters.php | 3 +- .../Controllers/Admin/ChannelController.php | 2 +- .../Controllers/Admin/ThreadController.php | 2 +- .../Controllers/Auth/RegisterController.php | 18 +- app/Http/Controllers/Controller.php | 8 +- app/Http/Controllers/ProfileController.php | 10 +- app/Http/Controllers/ReplyController.php | 14 +- app/Http/Controllers/ThreadController.php | 34 ++-- .../ThreadSubscriptionsController.php | 2 +- app/Http/Kernel.php | 18 +- app/Http/Middleware/Administrator.php | 5 +- app/Http/Middleware/Authenticate.php | 5 +- app/Http/Middleware/Localization.php | 7 +- .../Middleware/RedirectIfAuthenticated.php | 7 +- app/Http/Middleware/TrustProxies.php | 2 +- app/Listeners/NotifyMentionedUsers.php | 7 +- app/Listeners/NotifyThreadSubscribers.php | 3 +- app/Notifications/ThreadWasUpdated.php | 4 +- app/Notifications/YouWereMentioned.php | 10 +- app/Policies/ReplyPolicy.php | 2 +- app/Policies/ThreadPolicy.php | 33 ++-- app/Providers/AppServiceProvider.php | 4 +- app/Providers/AuthServiceProvider.php | 7 +- app/Providers/BroadcastServiceProvider.php | 2 +- app/Providers/RouteServiceProvider.php | 2 +- app/RecordsActivity.php | 6 +- app/Reply.php | 5 +- app/Rules/Recaptcha.php | 11 +- app/Thread.php | 7 +- app/Trending.php | 13 +- app/User.php | 6 +- config/app.php | 68 ++++---- config/auth.php | 14 +- config/broadcasting.php | 12 +- config/cache.php | 26 +-- config/database.php | 90 +++++----- config/filesystems.php | 12 +- config/hashing.php | 4 +- config/logging.php | 38 ++--- config/mail.php | 2 +- config/queue.php | 30 ++-- config/services.php | 8 +- database/factories/ReplyFactory.php | 6 +- database/factories/ThreadFactory.php | 10 +- database/factories/UserFactory.php | 10 +- .../2014_10_12_000000_create_users_table.php | 4 +- ...12_100000_create_password_resets_table.php | 4 +- ..._08_19_000000_create_failed_jobs_table.php | 4 +- ...2021_08_09_140646_create_threads_table.php | 4 +- ...2021_08_09_142907_create_replies_table.php | 4 +- ...51923_add_foreign_key_to_threads_table.php | 4 +- ...021_08_09_155834_create_channels_table.php | 4 +- public/index.php | 4 +- resources/lang/en/auth.php | 2 +- resources/lang/en/messages.php | 156 +++++++++--------- resources/lang/en/pagination.php | 2 +- resources/lang/en/passwords.php | 4 +- resources/lang/en/validation.php | 156 +++++++++--------- resources/lang/zh-CN/messages.php | 156 +++++++++--------- routes/web.php | 8 +- server.php | 4 +- tests/Feature/CreateThreadsTest.php | 6 +- tests/Feature/ExampleTest.php | 1 - tests/Feature/ParticipateInForum.php | 10 +- tests/Feature/ThreadsTest.php | 9 +- tests/Unit/ExampleTest.php | 1 - tests/Unit/ReplyTest.php | 2 +- tests/Unit/ThreadTest.php | 10 +- 74 files changed, 597 insertions(+), 583 deletions(-) diff --git a/app/Channel.php b/app/Channel.php index 4716f32..dc7c3aa 100644 --- a/app/Channel.php +++ b/app/Channel.php @@ -2,8 +2,8 @@ namespace App; -use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Str; class Channel extends Model { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a8c5158..29934ca 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -19,7 +19,8 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * * @return void */ protected function schedule(Schedule $schedule) diff --git a/app/Events/ThreadReceivedNewReply.php b/app/Events/ThreadReceivedNewReply.php index d0a5367..7f37536 100644 --- a/app/Events/ThreadReceivedNewReply.php +++ b/app/Events/ThreadReceivedNewReply.php @@ -2,14 +2,16 @@ namespace App\Events; -use Illuminate\Queue\SerializesModels; +use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Broadcasting\InteractsWithSockets; +use Illuminate\Queue\SerializesModels; class ThreadReceivedNewReply { - use Dispatchable, InteractsWithSockets, SerializesModels; + use Dispatchable; + use InteractsWithSockets; + use SerializesModels; public $reply; diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 043cad6..3b97f12 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -29,7 +29,8 @@ class Handler extends ExceptionHandler /** * Report or log an exception. * - * @param \Exception $exception + * @param \Exception $exception + * * @return void */ public function report(Exception $exception) @@ -40,8 +41,9 @@ public function report(Exception $exception) /** * Render an exception into an HTTP response. * - * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Illuminate\Http\Request $request + * @param \Exception $exception + * * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) diff --git a/app/Extensions/EloquentUserProvider.php b/app/Extensions/EloquentUserProvider.php index ea76012..3a9028f 100644 --- a/app/Extensions/EloquentUserProvider.php +++ b/app/Extensions/EloquentUserProvider.php @@ -2,15 +2,16 @@ namespace App\Extensions; -use Illuminate\Support\Str; use Illuminate\Auth\EloquentUserProvider as BaseUserProvider; +use Illuminate\Support\Str; class EloquentUserProvider extends BaseUserProvider { /** * Retrieve a user by the given credentials. * - * @param array $credentials + * @param array $credentials + * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object */ public function retrieveByCredentials(array $credentials) diff --git a/app/Favoritable.php b/app/Favoritable.php index 27f72ea..fcbdbbc 100644 --- a/app/Favoritable.php +++ b/app/Favoritable.php @@ -2,8 +2,6 @@ namespace App; -use Illuminate\Database\Eloquent\Model; - trait Favoritable { protected static function bootFavoritable() @@ -22,7 +20,7 @@ public function favorite() { $arrtributes = ['user_id' => auth()->id()]; - if (! $this->favorites()->where($arrtributes)->exists()){ + if (!$this->favorites()->where($arrtributes)->exists()) { return $this->favorites()->create($arrtributes); } } @@ -36,7 +34,7 @@ public function unfavorite() public function isFavorited() { - return ! ! $this->favorites->where('user_id', auth()->id())->count(); + return (bool) $this->favorites->where('user_id', auth()->id())->count(); } public function getIsFavoritedAttribute() diff --git a/app/Filters/Filters.php b/app/Filters/Filters.php index 24c212d..9b8bba1 100644 --- a/app/Filters/Filters.php +++ b/app/Filters/Filters.php @@ -6,7 +6,8 @@ abstract class Filters { - protected $request, $builder; + protected $request; + protected $builder; protected $filters = []; diff --git a/app/Http/Controllers/Admin/ChannelController.php b/app/Http/Controllers/Admin/ChannelController.php index 112113f..293af43 100644 --- a/app/Http/Controllers/Admin/ChannelController.php +++ b/app/Http/Controllers/Admin/ChannelController.php @@ -23,7 +23,7 @@ public function store() { $channel = Channel::create( request()->validate([ - 'name' => 'required|unique:channels', + 'name' => 'required|unique:channels', 'description' => 'required', ]) ); diff --git a/app/Http/Controllers/Admin/ThreadController.php b/app/Http/Controllers/Admin/ThreadController.php index f448045..b1ffda3 100644 --- a/app/Http/Controllers/Admin/ThreadController.php +++ b/app/Http/Controllers/Admin/ThreadController.php @@ -2,9 +2,9 @@ namespace App\Http\Controllers\Admin; +use App\Http\Controllers\Controller; use App\Thread; use App\Trending; -use App\Http\Controllers\Controller; class ThreadController extends Controller { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 8dbe56e..ccef56a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,11 +2,11 @@ namespace App\Http\Controllers\Auth; -use App\User; use App\Http\Controllers\Controller; +use App\User; +use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; -use Illuminate\Foundation\Auth\RegistersUsers; class RegisterController extends Controller { @@ -47,14 +47,15 @@ protected function redirectTo() /** * Get a validator for an incoming registration request. * - * @param array $data + * @param array $data + * * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ - 'name' => ['required', 'string', 'max:255', 'unique:users'], - 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'name' => ['required', 'string', 'max:255', 'unique:users'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); } @@ -62,14 +63,15 @@ protected function validator(array $data) /** * Create a new user instance after a valid registration. * - * @param array $data + * @param array $data + * * @return \App\User */ protected function create(array $data) { return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], + 'name' => $data['name'], + 'email' => $data['email'], 'password' => Hash::make($data['password']), ]); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 03e02a2..ce1176d 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,12 +2,14 @@ namespace App\Http\Controllers; +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests; + use DispatchesJobs; + use ValidatesRequests; } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 6919651..b5118d6 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers; -use App\User; use App\Activity; +use App\User; use Illuminate\Http\Request; class ProfileController extends Controller @@ -17,7 +17,7 @@ public function show(User $user) { return view('profiles.show', [ 'profileUser' => $user, - 'activities' => Activity::feed($user) + 'activities' => Activity::feed($user), ]); } @@ -36,12 +36,12 @@ public function read($user, $notificationId) public function avatar(Request $request, User $user) { request()->validate([ - 'avatar' => ['required', 'image'] + 'avatar' => ['required', 'image'], ]); if ($request->file('avatar')) { - $path = $request->file('avatar')->storePublicly('avatars/' . $user->name, 'public'); - $user->avatar = "/storage/" . $path; + $path = $request->file('avatar')->storePublicly('avatars/'.$user->name, 'public'); + $user->avatar = '/storage/'.$path; $user->save(); } diff --git a/app/Http/Controllers/ReplyController.php b/app/Http/Controllers/ReplyController.php index 8736660..f26a61e 100644 --- a/app/Http/Controllers/ReplyController.php +++ b/app/Http/Controllers/ReplyController.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; -use App\Reply; -use App\Thread; use App\Channel; +use App\Reply; use App\Rules\Recaptcha; +use App\Thread; class ReplyController extends Controller { @@ -16,15 +16,15 @@ public function __construct() public function store(Channel $channel, Thread $thread, Recaptcha $recaptcha) { - $this->validate(request(),[ - 'body' => 'required|min:3', + $this->validate(request(), [ + 'body' => 'required|min:3', 'g-recaptcha-response' => $recaptcha, ]); if ($thread->locked == false) { $reply = $thread->addReply([ - 'body' => request('body'), - 'user_id' => auth()->id() + 'body' => request('body'), + 'user_id' => auth()->id(), ]); if (request()->expectsJson()) { @@ -45,7 +45,7 @@ public function update(Reply $reply, Thread $thread, Recaptcha $recaptcha) $this->authorize('update', $reply); $this->validate(request(), [ - 'body' => 'required|min:3', + 'body' => 'required|min:3', 'g-recaptcha-response' => $recaptcha, ]); diff --git a/app/Http/Controllers/ThreadController.php b/app/Http/Controllers/ThreadController.php index f6b2783..0896d94 100644 --- a/app/Http/Controllers/ThreadController.php +++ b/app/Http/Controllers/ThreadController.php @@ -2,12 +2,12 @@ namespace App\Http\Controllers; -use App\Thread; use App\Channel; -use App\Trending; +use App\Filters\ThreadFilters; use App\Rules\Recaptcha; +use App\Thread; +use App\Trending; use Illuminate\Http\Request; -use App\Filters\ThreadFilters; class ThreadController extends Controller { @@ -25,8 +25,8 @@ public function index(Channel $channel, ThreadFilters $filters, Trending $trendi } return view('threads.index', [ - 'threads' => $threads, - 'trending' => $trending->get() + 'threads' => $threads, + 'trending' => $trending->get(), ]); } @@ -34,7 +34,7 @@ protected function getThreads(Channel $channel, ThreadFilters $filters) { $threads = Thread::filter($filters); - if ($channel->exists){ + if ($channel->exists) { $threads->where('channel_id', $channel->id); } @@ -51,9 +51,9 @@ public function show($channel, Thread $thread, Trending $trending) $thread->increment('visits'); return view('threads.show', [ - 'thread' => $thread, + 'thread' => $thread, 'trending' => $trending->get(), - 'replies' => $thread->replies()->paginate(20) + 'replies' => $thread->replies()->paginate(20), ]); } @@ -67,17 +67,17 @@ public function create() public function store(Request $request, Recaptcha $recaptcha) { $request->validate([ - 'title' => 'required|max:100|min:2', - 'body' => 'required|min:9', - 'channel_id' => 'required|exists:channels,id', + 'title' => 'required|max:100|min:2', + 'body' => 'required|min:9', + 'channel_id' => 'required|exists:channels,id', 'g-recaptcha-response' => $recaptcha, ]); $thread = Thread::create([ - 'user_id' => auth()->id(), + 'user_id' => auth()->id(), 'channel_id' => $request->channel_id, - 'title' => $request->title, - 'body' => $request->body, + 'title' => $request->title, + 'body' => $request->body, ]); if (request()->wantsJson()) { @@ -97,9 +97,9 @@ public function update($channel, Thread $thread, Recaptcha $recaptcha) $this->authorize('update', $thread); $this->validate(request(), [ - 'title' => 'required|max:100|min:2', - 'body' => 'required|min:9', - 'channel_id' => 'required|exists:channels,id', + 'title' => 'required|max:100|min:2', + 'body' => 'required|min:9', + 'channel_id' => 'required|exists:channels,id', 'g-recaptcha-response' => $recaptcha, ]); diff --git a/app/Http/Controllers/ThreadSubscriptionsController.php b/app/Http/Controllers/ThreadSubscriptionsController.php index 3aa5f3e..59eb257 100644 --- a/app/Http/Controllers/ThreadSubscriptionsController.php +++ b/app/Http/Controllers/ThreadSubscriptionsController.php @@ -15,7 +15,7 @@ public function __construct() public function subscribe($channelId, Thread $thread) { $param = [ - 'user_id' => auth()->id(), + 'user_id' => auth()->id(), 'thread_id' => $thread->id, ]; diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 11d8182..c5db9f4 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -52,16 +52,16 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, - 'admin' => \App\Http\Middleware\Administrator::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + 'admin' => \App\Http\Middleware\Administrator::class, ]; /** diff --git a/app/Http/Middleware/Administrator.php b/app/Http/Middleware/Administrator.php index 43f6f35..74bbbb6 100644 --- a/app/Http/Middleware/Administrator.php +++ b/app/Http/Middleware/Administrator.php @@ -9,8 +9,9 @@ class Administrator /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index a4be5c5..827e7c3 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -9,12 +9,13 @@ class Authenticate extends Middleware /** * Get the path the user should be redirected to when they are not authenticated. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return string */ protected function redirectTo($request) { - if (! $request->expectsJson()) { + if (!$request->expectsJson()) { return route('login'); } } diff --git a/app/Http/Middleware/Localization.php b/app/Http/Middleware/Localization.php index e7b189d..c952fe8 100644 --- a/app/Http/Middleware/Localization.php +++ b/app/Http/Middleware/Localization.php @@ -2,16 +2,17 @@ namespace App\Http\Middleware; -use Closure; use App; +use Closure; class Localization { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e4cec9c..afe1c26 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -10,9 +10,10 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * * @return mixed */ public function handle($request, Closure $next, $guard = null) diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 12fdf8b..ee5b595 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -2,8 +2,8 @@ namespace App\Http\Middleware; -use Illuminate\Http\Request; use Fideloper\Proxy\TrustProxies as Middleware; +use Illuminate\Http\Request; class TrustProxies extends Middleware { diff --git a/app/Listeners/NotifyMentionedUsers.php b/app/Listeners/NotifyMentionedUsers.php index bf65c0b..620e4d3 100644 --- a/app/Listeners/NotifyMentionedUsers.php +++ b/app/Listeners/NotifyMentionedUsers.php @@ -2,9 +2,9 @@ namespace App\Listeners; -use App\User; -use App\Notifications\YouWereMentioned; use App\Events\ThreadReceivedNewReply; +use App\Notifications\YouWereMentioned; +use App\User; class NotifyMentionedUsers { @@ -21,7 +21,8 @@ public function __construct() /** * Handle the event. * - * @param ThreadReceivedNewReply $event + * @param ThreadReceivedNewReply $event + * * @return void */ public function handle(ThreadReceivedNewReply $event) diff --git a/app/Listeners/NotifyThreadSubscribers.php b/app/Listeners/NotifyThreadSubscribers.php index 1172521..7131812 100644 --- a/app/Listeners/NotifyThreadSubscribers.php +++ b/app/Listeners/NotifyThreadSubscribers.php @@ -19,7 +19,8 @@ public function __construct() /** * Handle the event. * - * @param ThreadReceivedNewReply $event + * @param ThreadReceivedNewReply $event + * * @return void */ public function handle(ThreadReceivedNewReply $event) diff --git a/app/Notifications/ThreadWasUpdated.php b/app/Notifications/ThreadWasUpdated.php index ca63d36..d1253c8 100644 --- a/app/Notifications/ThreadWasUpdated.php +++ b/app/Notifications/ThreadWasUpdated.php @@ -24,8 +24,8 @@ public function via() public function toArray() { return [ - 'message' => $this->reply->owner->name . trans('messages.threads_replied_to') . $this->thread->title, - 'link' => $this->reply->path() + 'message' => $this->reply->owner->name.trans('messages.threads_replied_to').$this->thread->title, + 'link' => $this->reply->path(), ]; } } diff --git a/app/Notifications/YouWereMentioned.php b/app/Notifications/YouWereMentioned.php index 29a0f35..b93f5f8 100644 --- a/app/Notifications/YouWereMentioned.php +++ b/app/Notifications/YouWereMentioned.php @@ -24,7 +24,8 @@ public function __construct($reply) /** * Get the notification's delivery channels. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return array */ public function via($notifiable) @@ -35,14 +36,15 @@ public function via($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable + * @param mixed $notifiable + * * @return array */ public function toArray($notifiable) { return [ - 'message' => $this->reply->owner->name . trans('messages.threads_replied_mentioned') . $this->reply->thread->title, - 'link' => $this->reply->path() + 'message' => $this->reply->owner->name.trans('messages.threads_replied_mentioned').$this->reply->thread->title, + 'link' => $this->reply->path(), ]; } } diff --git a/app/Policies/ReplyPolicy.php b/app/Policies/ReplyPolicy.php index 38a051c..cc7fafd 100644 --- a/app/Policies/ReplyPolicy.php +++ b/app/Policies/ReplyPolicy.php @@ -2,8 +2,8 @@ namespace App\Policies; -use App\User; use App\Reply; +use App\User; use Illuminate\Auth\Access\HandlesAuthorization; class ReplyPolicy diff --git a/app/Policies/ThreadPolicy.php b/app/Policies/ThreadPolicy.php index 6911343..775941a 100644 --- a/app/Policies/ThreadPolicy.php +++ b/app/Policies/ThreadPolicy.php @@ -2,8 +2,8 @@ namespace App\Policies; -use App\User; use App\Thread; +use App\User; use Illuminate\Auth\Access\HandlesAuthorization; class ThreadPolicy @@ -13,7 +13,8 @@ class ThreadPolicy /** * Determine whether the user can view any threads. * - * @param \App\User $user + * @param \App\User $user + * * @return mixed */ public function viewAny(User $user) @@ -24,8 +25,9 @@ public function viewAny(User $user) /** * Determine whether the user can view the thread. * - * @param \App\User $user - * @param \App\Thread $thread + * @param \App\User $user + * @param \App\Thread $thread + * * @return mixed */ public function view(User $user, Thread $thread) @@ -36,7 +38,8 @@ public function view(User $user, Thread $thread) /** * Determine whether the user can create threads. * - * @param \App\User $user + * @param \App\User $user + * * @return mixed */ public function create(User $user) @@ -47,8 +50,9 @@ public function create(User $user) /** * Determine whether the user can update the thread. * - * @param \App\User $user - * @param \App\Thread $thread + * @param \App\User $user + * @param \App\Thread $thread + * * @return mixed */ public function update(User $user, Thread $thread) @@ -59,8 +63,9 @@ public function update(User $user, Thread $thread) /** * Determine whether the user can delete the thread. * - * @param \App\User $user - * @param \App\Thread $thread + * @param \App\User $user + * @param \App\Thread $thread + * * @return mixed */ public function delete(User $user, Thread $thread) @@ -71,8 +76,9 @@ public function delete(User $user, Thread $thread) /** * Determine whether the user can restore the thread. * - * @param \App\User $user - * @param \App\Thread $thread + * @param \App\User $user + * @param \App\Thread $thread + * * @return mixed */ public function restore(User $user, Thread $thread) @@ -83,8 +89,9 @@ public function restore(User $user, Thread $thread) /** * Determine whether the user can permanently delete the thread. * - * @param \App\User $user - * @param \App\Thread $thread + * @param \App\User $user + * @param \App\Thread $thread + * * @return mixed */ public function forceDelete(User $user, Thread $thread) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 61691fe..63de93c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,8 +3,8 @@ namespace App\Providers; use App\Channel; -use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -26,7 +26,7 @@ public function register() */ public function boot() { - View::composer('*', function ($view){ + View::composer('*', function ($view) { $channels = Cache::rememberForever('channels', function () { return Channel::orderBy('name')->get(); }); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 6026e3a..b1f2671 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -3,9 +3,8 @@ namespace App\Providers; use App\Extensions\EloquentUserProvider; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Auth; class AuthServiceProvider extends ServiceProvider { @@ -17,8 +16,8 @@ class AuthServiceProvider extends ServiceProvider protected $policies = [ // 'App\Model' => 'App\Policies\ModelPolicy', 'App\Thread' => 'App\Policies\ThreadPolicy', - 'App\Reply' => 'App\Policies\ReplyPolicy', - 'App\User' => 'App\Policies\UserPolicy', + 'App\Reply' => 'App\Policies\ReplyPolicy', + 'App\User' => 'App\Policies\UserPolicy', ]; /** diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 352cce4..395c518 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Broadcast; +use Illuminate\Support\ServiceProvider; class BroadcastServiceProvider extends ServiceProvider { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 5ea48d3..548e4be 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { diff --git a/app/RecordsActivity.php b/app/RecordsActivity.php index 7e3bda0..63e38ea 100644 --- a/app/RecordsActivity.php +++ b/app/RecordsActivity.php @@ -8,7 +8,9 @@ trait RecordsActivity { protected static function bootRecordsActivity() { - if (auth()->guest()) return; + if (auth()->guest()) { + return; + } foreach (static::getActivitiesToRecord() as $event) { static::$event(function ($model) use ($event) { @@ -30,7 +32,7 @@ protected function recordActivity($event) { $this->activity()->create([ 'user_id' => auth()->id(), - 'type' => $this->getActivityType($event) + 'type' => $this->getActivityType($event), ]); } diff --git a/app/Reply.php b/app/Reply.php index 35a9040..5b1cc65 100644 --- a/app/Reply.php +++ b/app/Reply.php @@ -6,7 +6,8 @@ class Reply extends Model { - use Favoritable, RecordsActivity; + use Favoritable; + use RecordsActivity; protected $guarded = []; @@ -47,7 +48,7 @@ public function thread() public function path() { - return $this->thread->path() . "#reply-{$this->owner->name}-{$this->id}"; + return $this->thread->path()."#reply-{$this->owner->name}-{$this->id}"; } public function mentionedUsers() diff --git a/app/Rules/Recaptcha.php b/app/Rules/Recaptcha.php index 8946785..a25ed9c 100644 --- a/app/Rules/Recaptcha.php +++ b/app/Rules/Recaptcha.php @@ -2,8 +2,8 @@ namespace App\Rules; -use Zttp\Zttp; use Illuminate\Contracts\Validation\Rule; +use Zttp\Zttp; class Recaptcha implements Rule { @@ -23,16 +23,17 @@ public function __construct() /** * Determine if the validation rule passes. * - * @param string $attribute - * @param mixed $value + * @param string $attribute + * @param mixed $value + * * @return bool */ public function passes($attribute, $value) { return Zttp::asFormParams()->post(static::URL, [ - 'secret' => config('services.recaptcha.secret'), + 'secret' => config('services.recaptcha.secret'), 'response' => $value, - 'remoteip' => request()->ip() + 'remoteip' => request()->ip(), ])->json()['success']; } diff --git a/app/Thread.php b/app/Thread.php index d8f7839..9cfa772 100644 --- a/app/Thread.php +++ b/app/Thread.php @@ -2,8 +2,8 @@ namespace App; -use App\Filters\ThreadFilters; use App\Events\ThreadReceivedNewReply; +use App\Filters\ThreadFilters; use Illuminate\Database\Eloquent\Model; class Thread extends Model @@ -72,8 +72,7 @@ public function setTitleAttribute($value) { $this->attributes['title'] = $value; - if (! $this->exists) - { + if (!$this->exists) { $this->attributes['slug'] = str_replace(' ', '-', $value); } } @@ -130,6 +129,6 @@ public function markBestReply(Reply $reply) public function hasBestReply() { - return ! is_null($this->best_reply_id); + return !is_null($this->best_reply_id); } } diff --git a/app/Trending.php b/app/Trending.php index 53ce4e2..b9f6c99 100644 --- a/app/Trending.php +++ b/app/Trending.php @@ -7,7 +7,7 @@ class Trending { /** - * 获取所有热门线程 + * 获取所有热门线程. * * @return array */ @@ -20,7 +20,7 @@ public function get() } /** - * 获取缓存键名 + * 获取缓存键名. * * @return string */ @@ -30,19 +30,18 @@ private function cacheKey() } /** - * 将新线程推送到热门线程列表 + * 将新线程推送到热门线程列表. * * @param Thread $thread */ public function push($thread, $increment = 1) { - $trending = Cache::get($this->cacheKey(), collect()); $trending[$thread->id] = (object) [ 'score' => $this->score($thread) + $increment, 'title' => $thread->title, - 'path' => $thread->path(), + 'path' => $thread->path(), ]; Cache::forever($this->cacheKey(), $trending); @@ -52,7 +51,7 @@ public function score($thread) { $trending = Cache::get($this->cacheKey(), collect()); - if (! isset($trending[$thread->id])) { + if (!isset($trending[$thread->id])) { return 0; } @@ -60,7 +59,7 @@ public function score($thread) } /** - * 重置所有热门线程 + * 重置所有热门线程. */ public function reset() { diff --git a/app/User.php b/app/User.php index 1c06463..167eb37 100644 --- a/app/User.php +++ b/app/User.php @@ -3,9 +3,9 @@ namespace App; use Carbon\Carbon; -use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Notifications\Notifiable; class User extends Authenticatable implements MustVerifyEmail { @@ -17,7 +17,7 @@ class User extends Authenticatable implements MustVerifyEmail * @var array */ protected $fillable = [ - 'name', 'email', 'password', 'avatar' + 'name', 'email', 'password', 'avatar', ]; /** @@ -65,7 +65,7 @@ public function read($thread) public function visitedThreadCacheKey($thread) { - return sprintf("users.%s.visits.%s", $this->id, $thread->id); + return sprintf('users.%s.visits.%s', $this->id, $thread->id); } public function lastReply() diff --git a/config/app.php b/config/app.php index c479b27..52424e1 100644 --- a/config/app.php +++ b/config/app.php @@ -190,41 +190,41 @@ 'aliases' => [ - 'App' => Illuminate\Support\Facades\App::class, - 'Arr' => Illuminate\Support\Arr::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, + 'App' => Illuminate\Support\Facades\App::class, + 'Arr' => Illuminate\Support\Arr::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'Str' => Illuminate\Support\Str::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Str' => Illuminate\Support\Str::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, ], diff --git a/config/auth.php b/config/auth.php index 897dc82..ac85631 100644 --- a/config/auth.php +++ b/config/auth.php @@ -14,7 +14,7 @@ */ 'defaults' => [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -37,14 +37,14 @@ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], 'api' => [ - 'driver' => 'token', + 'driver' => 'token', 'provider' => 'users', - 'hash' => false, + 'hash' => false, ], ], @@ -68,7 +68,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\User::class, + 'model' => App\User::class, ], // 'users' => [ @@ -95,8 +95,8 @@ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, ], ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 3bba110..ec2d8a3 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -31,18 +31,18 @@ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), - 'useTLS' => true, + 'useTLS' => true, ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index 46751e6..0cbc938 100644 --- a/config/cache.php +++ b/config/cache.php @@ -42,20 +42,20 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], @@ -64,24 +64,24 @@ ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'cache', ], 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], diff --git a/config/database.php b/config/database.php index 199382d..273e1f6 100644 --- a/config/database.php +++ b/config/database.php @@ -36,58 +36,58 @@ 'connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, - 'schema' => 'public', - 'sslmode' => 'prefer', + 'schema' => 'public', + 'sslmode' => 'prefer', ], 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, ], @@ -123,22 +123,22 @@ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), + 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DB', 0), ], 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), + 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_CACHE_DB', 1), ], diff --git a/config/filesystems.php b/config/filesystems.php index ec6a7ce..e92b5c1 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -45,23 +45,23 @@ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path('app'), ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), + 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), + 'url' => env('AWS_URL'), ], ], diff --git a/config/hashing.php b/config/hashing.php index 8425770..5b10c09 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -44,9 +44,9 @@ */ 'argon' => [ - 'memory' => 1024, + 'memory' => 1024, 'threads' => 2, - 'time' => 2, + 'time' => 2, ], ]; diff --git a/config/logging.php b/config/logging.php index d09cd7d..a0f9da1 100644 --- a/config/logging.php +++ b/config/logging.php @@ -35,36 +35,36 @@ 'channels' => [ 'stack' => [ - 'driver' => 'stack', - 'channels' => ['daily'], + 'driver' => 'stack', + 'channels' => ['daily'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', ], 'daily' => [ 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', - 'days' => 14, + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + 'days' => 14, ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => 'critical', + 'emoji' => ':boom:', + 'level' => 'critical', ], 'papertrail' => [ - 'driver' => 'monolog', - 'level' => 'debug', - 'handler' => SyslogUdpHandler::class, + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), @@ -72,22 +72,22 @@ ], 'stderr' => [ - 'driver' => 'monolog', - 'handler' => StreamHandler::class, + 'driver' => 'monolog', + 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ + 'with' => [ 'stream' => 'php://stderr', ], ], 'syslog' => [ 'driver' => 'syslog', - 'level' => 'debug', + 'level' => 'debug', ], 'errorlog' => [ 'driver' => 'errorlog', - 'level' => 'debug', + 'level' => 'debug', ], ], diff --git a/config/mail.php b/config/mail.php index 3c65eb3..c939f11 100644 --- a/config/mail.php +++ b/config/mail.php @@ -57,7 +57,7 @@ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* diff --git a/config/queue.php b/config/queue.php index 3a30d6c..3895ab4 100644 --- a/config/queue.php +++ b/config/queue.php @@ -35,35 +35,35 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, - 'block_for' => 0, + 'block_for' => 0, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), + 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'your-queue-name'), + 'queue' => env('SQS_QUEUE', 'your-queue-name'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, - 'block_for' => null, + 'block_for' => null, ], ], @@ -80,9 +80,9 @@ */ 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), + 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index 742adc6..156e227 100644 --- a/config/services.php +++ b/config/services.php @@ -15,8 +15,8 @@ */ 'mailgun' => [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], @@ -25,12 +25,12 @@ ], 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), + 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'recaptcha' => [ 'secret' => env('RECAPTCHA_SECRET'), - ] + ], ]; diff --git a/database/factories/ReplyFactory.php b/database/factories/ReplyFactory.php index 7cb2bf2..1ae96af 100644 --- a/database/factories/ReplyFactory.php +++ b/database/factories/ReplyFactory.php @@ -2,15 +2,15 @@ /** @var \Illuminate\Database\Eloquent\Factory $factory */ -use App\Thread; use App\Reply; +use App\Thread; use App\User; use Faker\Generator as Faker; $factory->define(Reply::class, function (Faker $faker) { return [ - 'user_id' => User::count() ? User::pluck('id')->random() : factory(User::class), + 'user_id' => User::count() ? User::pluck('id')->random() : factory(User::class), 'thread_id' => factory(Thread::class), - 'body' => $faker->paragraph, + 'body' => $faker->paragraph, ]; }); diff --git a/database/factories/ThreadFactory.php b/database/factories/ThreadFactory.php index b8dd2c9..2f565e2 100644 --- a/database/factories/ThreadFactory.php +++ b/database/factories/ThreadFactory.php @@ -11,11 +11,11 @@ $title = $faker->sentence; return [ - 'user_id' => User::count() ? User::pluck('id')->random() : factory(User::class), + 'user_id' => User::count() ? User::pluck('id')->random() : factory(User::class), 'channel_id' => factory(Channel::class), - 'title' => $title, - 'body' => $faker->paragraph, - 'visits' => 0, - 'locked' => false + 'title' => $title, + 'body' => $faker->paragraph, + 'visits' => 0, + 'locked' => false, ]; }); diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 545516c..1bada7a 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -3,8 +3,8 @@ /** @var \Illuminate\Database\Eloquent\Factory $factory */ use App\User; -use Illuminate\Support\Str; use Faker\Generator as Faker; +use Illuminate\Support\Str; /* |-------------------------------------------------------------------------- @@ -19,10 +19,10 @@ $factory->define(User::class, function (Faker $faker) { return [ - 'name' => $faker->name, - 'email' => $faker->unique()->safeEmail, + 'name' => $faker->name, + 'email' => $faker->unique()->safeEmail, 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password - 'remember_token' => Str::random(10), + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'remember_token' => Str::random(10), ]; }); diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 52609ac..9e344e8 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,8 +1,8 @@ */ - define('LARAVEL_START', microtime(true)); /* diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index e5506df..6ef1a73 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -13,7 +13,7 @@ | */ - 'failed' => 'These credentials do not match our records.', + 'failed' => 'These credentials do not match our records.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ]; diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index f94b5ee..4c99a3e 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -13,114 +13,114 @@ | */ - 'auth_login' => 'Login', - 'auth_register' => 'Register', - 'auth_home' => 'Home', - 'auth_logout' => 'Logout', - 'auth_name' => 'Name', - 'auth_email' => 'Email', - 'auth_password' => 'Password', - 'auth_password_confirmation' => 'Password Confirmation', - 'auth_remember_password' => 'Remember Me', - 'auth_forgot_password' => 'Forgot Your Password?', - 'auth_placeholder' => 'Enter mailbox or user name', - 'auth_verify' => 'Email verify', - 'auth_verify_email_address' => 'Verify Your Email Address', + 'auth_login' => 'Login', + 'auth_register' => 'Register', + 'auth_home' => 'Home', + 'auth_logout' => 'Logout', + 'auth_name' => 'Name', + 'auth_email' => 'Email', + 'auth_password' => 'Password', + 'auth_password_confirmation' => 'Password Confirmation', + 'auth_remember_password' => 'Remember Me', + 'auth_forgot_password' => 'Forgot Your Password?', + 'auth_placeholder' => 'Enter mailbox or user name', + 'auth_verify' => 'Email verify', + 'auth_verify_email_address' => 'Verify Your Email Address', 'auth_verify_email_address_alert_success' => 'A fresh verification link has been sent to your email address.', - 'auth_verify_email_address_alert_wait' => 'Before proceeding, please check your email for a verification link. If you did not receive the email,', - 'auth_verify_resend' => 'click here to request another.', - 'auth_confirm_password' => 'Confirm Password', - 'auth_confirm_password_before' => 'Please confirm your password before continuing.', - 'auth_reset_password' => 'Reset Password', - 'auth_send_password_reset_link' => 'Send Password Reset Link', - - 'nav_browse' => 'Browse', - 'nav_all_threads' => 'All Threads', - 'nav_my_threads' => 'My Threads', - 'nav_popular_threads' => 'Popular Threads', + 'auth_verify_email_address_alert_wait' => 'Before proceeding, please check your email for a verification link. If you did not receive the email,', + 'auth_verify_resend' => 'click here to request another.', + 'auth_confirm_password' => 'Confirm Password', + 'auth_confirm_password_before' => 'Please confirm your password before continuing.', + 'auth_reset_password' => 'Reset Password', + 'auth_send_password_reset_link' => 'Send Password Reset Link', + + 'nav_browse' => 'Browse', + 'nav_all_threads' => 'All Threads', + 'nav_my_threads' => 'My Threads', + 'nav_popular_threads' => 'Popular Threads', 'nav_unanswered_threads' => 'Unanswered Threads', - 'nav_new_thread' => 'New Thread', - 'nav_channels' => 'Channels', + 'nav_new_thread' => 'New Thread', + 'nav_channels' => 'Channels', - 'welcome_title' => 'Welcome to ', + 'welcome_title' => 'Welcome to ', 'welcome_featurette_heading' => 'The forum is built based on Laravel.', - 'welcome_featurette-text' => 'We are committed to exchanging computer science and technology and trying to make our voices heard all over the world. Want to try PHP, the best language in the world? Welcome to contribute code. If you like, you can light up a small star for the project. Finally, take care of yourself and happy coding!', + 'welcome_featurette-text' => 'We are committed to exchanging computer science and technology and trying to make our voices heard all over the world. Want to try PHP, the best language in the world? Welcome to contribute code. If you like, you can light up a small star for the project. Finally, take care of yourself and happy coding!', - 'threads_index_title' => 'Threads page', - 'threads_index_published' => 'published this thread', + 'threads_index_title' => 'Threads page', + 'threads_index_published' => 'published this thread', 'threads_index_there_have_been' => 'There have been', - 'threads_visits' => 'visits,', - 'threads_replies' => 'replies.', - 'threads_index_empty' => 'There are no relevant results at this time(= ̄ω ̄=)...', - 'threads_trending' => 'Trending threads', - 'threads_no_trending' => 'There is no trending threads for this week yet.', + 'threads_visits' => 'visits,', + 'threads_replies' => 'replies.', + 'threads_index_empty' => 'There are no relevant results at this time(= ̄ω ̄=)...', + 'threads_trending' => 'Trending threads', + 'threads_no_trending' => 'There is no trending threads for this week yet.', - 'threads_show_title' => 'Detail page', + 'threads_show_title' => 'Detail page', 'threads_reply_placeholder' => 'Is there anything you want to say?', - 'threads_discussion'=> 'Contribute to the Discussion', - 'threads_reply_button' => 'Reply', - 'threads_reply_favorite' => 'favorite', - 'threads_replied' => 'replied', - 'threads_replied_to' => ' replied to ', + 'threads_discussion' => 'Contribute to the Discussion', + 'threads_reply_button' => 'Reply', + 'threads_reply_favorite' => 'favorite', + 'threads_replied' => 'replied', + 'threads_replied_to' => ' replied to ', 'threads_set_as_best_reply' => 'Set as best', - 'threads_best_reply' => 'Best', - 'threads_reply_success' => 'Your reply has been left.', - 'threads_login_to_reply' => 'Please click here to login to comment', + 'threads_best_reply' => 'Best', + 'threads_reply_success' => 'Your reply has been left.', + 'threads_login_to_reply' => 'Please click here to login to comment', 'threads_replied_mentioned' => ' mentioned you in ', - 'threads_create_title' => 'Create a New Thread', - 'threads_create_editor' => 'en_GB', + 'threads_create_title' => 'Create a New Thread', + 'threads_create_editor' => 'en_GB', 'threads_choose_channel' => 'Choose a Channel...', - 'threads_title' => 'title', - 'threads_content' => 'content', + 'threads_title' => 'title', + 'threads_content' => 'content', 'threads_publish_thread' => 'Publish', - 'threads_create_errors' => 'Oops! There seems to be a problem with your input.', + 'threads_create_errors' => 'Oops! There seems to be a problem with your input.', 'threads_create_success' => 'Your thread has been successfully published!', - 'threads_delete' => 'Delete', + 'threads_delete' => 'Delete', 'threads_delete_thread_success' => 'The thread has been deleted successfully!', - 'threads_delete_reply_success' => 'The reply has been deleted successfully!', + 'threads_delete_reply_success' => 'The reply has been deleted successfully!', - 'threads_edit' => 'Edit', + 'threads_edit' => 'Edit', 'threads_edit_success' => 'Edit succeeded!', - 'threads_subscribe' => 'Subscribe', - 'threads_unsubscribe' => 'Unsubscribe', - 'threads_subscribe_success' => 'Subscribe succeeded!', - 'threads_unsubscribe_success' => 'Unsubscribe succeeded!', - 'threads_subscribe_notices' => 'There is no notification at present', + 'threads_subscribe' => 'Subscribe', + 'threads_unsubscribe' => 'Unsubscribe', + 'threads_subscribe_success' => 'Subscribe succeeded!', + 'threads_unsubscribe_success' => 'Unsubscribe succeeded!', + 'threads_subscribe_notices' => 'There is no notification at present', 'threads_subscribe_notices_mark' => 'Mark as read', - 'threads_locked' => 'The thread has been locked, unable to reply.', + 'threads_locked' => 'The thread has been locked, unable to reply.', 'threads_locked_thread_permission' => 'You do not have permission to perform this action.', - 'threads_locked_success' => 'The thread has been locked successfully!', - 'threads_unlocked_success' => 'The thread has been unlocked successfully!', + 'threads_locked_success' => 'The thread has been locked successfully!', + 'threads_unlocked_success' => 'The thread has been unlocked successfully!', - 'home_title' => '\'s personal home page', + 'home_title' => '\'s personal home page', 'home_welcome_back' => 'Welcome back! ', - 'profiles_title' => 'User Profile', - 'profiles_joined' => 'Joined', - 'profiles_no_activity' => 'There is no activity for this user yet.', - 'profiles_favorited_activity' => 'favorited', + 'profiles_title' => 'User Profile', + 'profiles_joined' => 'Joined', + 'profiles_no_activity' => 'There is no activity for this user yet.', + 'profiles_favorited_activity' => 'favorited', 'profiles_favorited_reply_activity' => '\'s reply', - 'profiles_edit_avatar' => 'Edit avatar', - 'profiles_edit_avatar_success' => 'Avatar modified successfully!', + 'profiles_edit_avatar' => 'Edit avatar', + 'profiles_edit_avatar_success' => 'Avatar modified successfully!', 'search_result_not_null' => 'The server found', - 'search_result' => 'results in total.', - 'search_result_null' => 'The server has not found the result yet.', + 'search_result' => 'results in total.', + 'search_result_null' => 'The server has not found the result yet.', 'recaptcha' => 'The recaptcha verification failed. Try again.', - 'admin_dashboard' => 'DashBoard', - 'admin_channel_name' => 'Channel name:', - 'admin_channel_description' => 'Description:', - 'admin_channel_slug' => 'Slug:', - 'admin_channel_threads' => 'threads:', - 'admin_new_channel' => 'New channel', - 'admin_add_channel' => 'Add new channel', - 'admin_add_channel_success' => 'Channel created successfully!', - 'admin_reset_threads_trending' => 'Reset all trending threads', + 'admin_dashboard' => 'DashBoard', + 'admin_channel_name' => 'Channel name:', + 'admin_channel_description' => 'Description:', + 'admin_channel_slug' => 'Slug:', + 'admin_channel_threads' => 'threads:', + 'admin_new_channel' => 'New channel', + 'admin_add_channel' => 'Add new channel', + 'admin_add_channel_success' => 'Channel created successfully!', + 'admin_reset_threads_trending' => 'Reset all trending threads', 'admin_reset_threads_trending_success' => 'Reset all trending threads succeeded!', ]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index d481411..fcab34b 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -14,6 +14,6 @@ */ 'previous' => '« Previous', - 'next' => 'Next »', + 'next' => 'Next »', ]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index f3b01a4..8e7e78b 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -14,8 +14,8 @@ */ 'reset' => 'Your password has been reset!', - 'sent' => 'We have e-mailed your password reset link!', + 'sent' => 'We have e-mailed your password reset link!', 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that e-mail address.", + 'user' => "We can't find a user with that e-mail address.", ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index e1d879f..3c1ebef 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -13,109 +13,109 @@ | */ - 'accepted' => 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', + 'accepted' => 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ + 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute must have between :min and :max items.', ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_equals' => 'The :attribute must be a date equal to :date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'gt' => [ + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'ends_with' => 'The :attribute must end with one of the following: :values', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ 'numeric' => 'The :attribute must be greater than :value.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'string' => 'The :attribute must be greater than :value characters.', - 'array' => 'The :attribute must have more than :value items.', + 'file' => 'The :attribute must be greater than :value kilobytes.', + 'string' => 'The :attribute must be greater than :value characters.', + 'array' => 'The :attribute must have more than :value items.', ], 'gte' => [ 'numeric' => 'The :attribute must be greater than or equal :value.', - 'file' => 'The :attribute must be greater than or equal :value kilobytes.', - 'string' => 'The :attribute must be greater than or equal :value characters.', - 'array' => 'The :attribute must have :value items or more.', + 'file' => 'The :attribute must be greater than or equal :value kilobytes.', + 'string' => 'The :attribute must be greater than or equal :value characters.', + 'array' => 'The :attribute must have :value items or more.', ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lt' => [ + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'ipv4' => 'The :attribute must be a valid IPv4 address.', + 'ipv6' => 'The :attribute must be a valid IPv6 address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'lt' => [ 'numeric' => 'The :attribute must be less than :value.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'string' => 'The :attribute must be less than :value characters.', - 'array' => 'The :attribute must have less than :value items.', + 'file' => 'The :attribute must be less than :value kilobytes.', + 'string' => 'The :attribute must be less than :value characters.', + 'array' => 'The :attribute must have less than :value items.', ], 'lte' => [ 'numeric' => 'The :attribute must be less than or equal :value.', - 'file' => 'The :attribute must be less than or equal :value kilobytes.', - 'string' => 'The :attribute must be less than or equal :value characters.', - 'array' => 'The :attribute must not have more than :value items.', + 'file' => 'The :attribute must be less than or equal :value kilobytes.', + 'string' => 'The :attribute must be less than or equal :value characters.', + 'array' => 'The :attribute must not have more than :value items.', ], 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'string' => 'The :attribute may not be greater than :max characters.', - 'array' => 'The :attribute may not have more than :max items.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', ], - 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimes' => 'The :attribute must be a file of type: :values.', 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ + 'min' => [ 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', ], - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'present' => 'The :attribute field must be present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values are present.', - 'required_without' => 'The :attribute field is required when :values is not present.', + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute format is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'present' => 'The :attribute field must be present.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ + 'same' => 'The :attribute and :other must match.', + 'size' => [ 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', ], 'starts_with' => 'The :attribute must start with one of the following: :values', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', - 'uuid' => 'The :attribute must be a valid UUID.', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'url' => 'The :attribute format is invalid.', + 'uuid' => 'The :attribute must be a valid UUID.', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/zh-CN/messages.php b/resources/lang/zh-CN/messages.php index f630f0b..825e6d0 100644 --- a/resources/lang/zh-CN/messages.php +++ b/resources/lang/zh-CN/messages.php @@ -13,114 +13,114 @@ | */ - 'auth_login' => '登录', - 'auth_register' => '注册', - 'auth_home' => '个人中心', - 'auth_logout' => '登出', - 'auth_name' => '昵称', - 'auth_email' => '邮箱', - 'auth_password' => '密码', - 'auth_password_confirmation' => '确认密码', - 'auth_remember_password' => '记住密码', - 'auth_forgot_password' => '忘记密码?', - 'auth_placeholder' => '输入邮箱或用户名', - 'auth_verify' => '邮箱验证', - 'auth_verify_email_address' => '验证您的邮箱地址', + 'auth_login' => '登录', + 'auth_register' => '注册', + 'auth_home' => '个人中心', + 'auth_logout' => '登出', + 'auth_name' => '昵称', + 'auth_email' => '邮箱', + 'auth_password' => '密码', + 'auth_password_confirmation' => '确认密码', + 'auth_remember_password' => '记住密码', + 'auth_forgot_password' => '忘记密码?', + 'auth_placeholder' => '输入邮箱或用户名', + 'auth_verify' => '邮箱验证', + 'auth_verify_email_address' => '验证您的邮箱地址', 'auth_verify_email_address_alert_success' => '已将新的验证链接发送到您的电子邮件地址。', - 'auth_verify_email_address_alert_wait' => '继续之前,请检查您的电子邮件中的验证链接。如果你没有收到邮件,', - 'auth_verify_resend' => '单击此处再一次请求。', - 'auth_confirm_password' => '确认密码', - 'auth_confirm_password_befor' => '继续之前,请确认您的密码。', - 'auth_reset_password' => '重置密码', - 'auth_send_password_reset_link' => '发送重置密码链接至邮箱', - - 'nav_browse' => '浏览', - 'nav_all_threads' => '所有帖子', - 'nav_my_threads' => '我的帖子', - 'nav_popular_threads' => '流行热帖', + 'auth_verify_email_address_alert_wait' => '继续之前,请检查您的电子邮件中的验证链接。如果你没有收到邮件,', + 'auth_verify_resend' => '单击此处再一次请求。', + 'auth_confirm_password' => '确认密码', + 'auth_confirm_password_befor' => '继续之前,请确认您的密码。', + 'auth_reset_password' => '重置密码', + 'auth_send_password_reset_link' => '发送重置密码链接至邮箱', + + 'nav_browse' => '浏览', + 'nav_all_threads' => '所有帖子', + 'nav_my_threads' => '我的帖子', + 'nav_popular_threads' => '流行热帖', 'nav_unanswered_threads' => '未读帖子', - 'nav_new_thread' => '发布新贴', - 'nav_channels' => '频道', + 'nav_new_thread' => '发布新贴', + 'nav_channels' => '频道', - 'welcome_title' => '欢迎来到', + 'welcome_title' => '欢迎来到', 'welcome_featurette_heading' => '本论坛基于 Laravel 构建。', - 'welcome_featurette-text' => '我们致力于交流计算机科学技术,并试图让全世界听见我们的声音。想试试世界上最好的语言 PHP?欢迎贡献代码,喜欢的话可以为该项目点亮一颗小星星。最后补充一句,Take care of yourself. Happy Coding!', + 'welcome_featurette-text' => '我们致力于交流计算机科学技术,并试图让全世界听见我们的声音。想试试世界上最好的语言 PHP?欢迎贡献代码,喜欢的话可以为该项目点亮一颗小星星。最后补充一句,Take care of yourself. Happy Coding!', - 'threads_index_title' => '首页', - 'threads_index_published' => '发布于', + 'threads_index_title' => '首页', + 'threads_index_published' => '发布于', 'threads_index_there_have_been' => '已有', - 'threads_visits' => '次浏览,', - 'threads_replies' => '条回复。', - 'threads_index_empty' => '目前尚无相关结果(= ̄ω ̄=)···', - 'threads_trending' => '热门话题', - 'threads_no_trending' => '本周尚无热门话题。', + 'threads_visits' => '次浏览,', + 'threads_replies' => '条回复。', + 'threads_index_empty' => '目前尚无相关结果(= ̄ω ̄=)···', + 'threads_trending' => '热门话题', + 'threads_no_trending' => '本周尚无热门话题。', - 'threads_show_title' => '详情页', + 'threads_show_title' => '详情页', 'threads_reply_placeholder' => '有什么想要说的吗?', - 'threads_discussion'=> '参与讨论', - 'threads_reply_button' => '回复', - 'threads_reply_favorite' => '赞赏', - 'threads_replied' => '回复于', - 'threads_replied_to' => ' 回复于 ', + 'threads_discussion' => '参与讨论', + 'threads_reply_button' => '回复', + 'threads_reply_favorite' => '赞赏', + 'threads_replied' => '回复于', + 'threads_replied_to' => ' 回复于 ', 'threads_set_as_best_reply' => '设为最佳', - 'threads_best_reply' => '最佳', - 'threads_reply_success' => '您的回复已经留下。', - 'threads_login_to_reply' => '请点击此处登录后评论', + 'threads_best_reply' => '最佳', + 'threads_reply_success' => '您的回复已经留下。', + 'threads_login_to_reply' => '请点击此处登录后评论', 'threads_replied_mentioned' => ' @了你 ', - 'threads_create_title' => '发布新贴', - 'threads_create_editor' => 'zh_CN', + 'threads_create_title' => '发布新贴', + 'threads_create_editor' => 'zh_CN', 'threads_choose_channel' => '点击选择一个频道···', - 'threads_title' => '标题', - 'threads_content' => '内容', + 'threads_title' => '标题', + 'threads_content' => '内容', 'threads_publish_thread' => '发布', - 'threads_create_errors' => '哎呀!看起来你的输入好像有点问题。', + 'threads_create_errors' => '哎呀!看起来你的输入好像有点问题。', 'threads_create_success' => '您的帖子已成功发布!', - 'threads_delete' => '删除', + 'threads_delete' => '删除', 'threads_delete_thread_success' => '删除帖子成功!', - 'threads_delete_reply_success' => '删除回复成功!', + 'threads_delete_reply_success' => '删除回复成功!', - 'threads_edit' => '编辑', + 'threads_edit' => '编辑', 'threads_edit_success' => '编辑成功!', - 'threads_subscribe' => '订阅', - 'threads_unsubscribe' => '取消订阅', - 'threads_subscribe_success' => '订阅成功!', - 'threads_unsubscribe_success' => '取消订阅成功!', - 'threads_subscribe_notices' => '目前尚无通知', + 'threads_subscribe' => '订阅', + 'threads_unsubscribe' => '取消订阅', + 'threads_subscribe_success' => '订阅成功!', + 'threads_unsubscribe_success' => '取消订阅成功!', + 'threads_subscribe_notices' => '目前尚无通知', 'threads_subscribe_notices_mark' => '标为已读', - 'threads_locked' => '本帖已被锁定,无法继续回复。', + 'threads_locked' => '本帖已被锁定,无法继续回复。', 'threads_locked_thread_permission' => '您无权执行此操作。', - 'threads_locked_success' => '帖子锁定成功!', - 'threads_unlocked_success' => '帖子解锁成功!', + 'threads_locked_success' => '帖子锁定成功!', + 'threads_unlocked_success' => '帖子解锁成功!', - 'home_title' => '的个人中心', + 'home_title' => '的个人中心', 'home_welcome_back' => '欢迎回来!', - 'profiles_title' => '个人简介', - 'profiles_joined' => '加入于', - 'profiles_no_activity' => '此用户尚未执行任何活动。', - 'profiles_favorited_activity' => '赞赏了', + 'profiles_title' => '个人简介', + 'profiles_joined' => '加入于', + 'profiles_no_activity' => '此用户尚未执行任何活动。', + 'profiles_favorited_activity' => '赞赏了', 'profiles_favorited_reply_activity' => '的回复', - 'profiles_edit_avatar' => '修改头像', - 'profiles_edit_avatar_success' => '头像修改成功!', + 'profiles_edit_avatar' => '修改头像', + 'profiles_edit_avatar_success' => '头像修改成功!', 'search_result_not_null' => '服务器君一共找到', - 'search_result' => '条搜索结果。', - 'search_result_null' => '服务器君暂时没有找到结果。', + 'search_result' => '条搜索结果。', + 'search_result_null' => '服务器君暂时没有找到结果。', 'recaptcha' => 'reCAPTCHA验证失败,再试一次。', - 'admin_dashboard' => '控制面板', - 'admin_channel_name' => '频道名称:', - 'admin_channel_description' => '频道描述:', - 'admin_channel_slug' => 'SEO标题:', - 'admin_channel_threads' => '帖子数:', - 'admin_new_channel' => '新频道', - 'admin_add_channel' => '添加新频道', - 'admin_add_channel_success' => '频道创建成功!', - 'admin_reset_threads_trending' => '重置热门话题', + 'admin_dashboard' => '控制面板', + 'admin_channel_name' => '频道名称:', + 'admin_channel_description' => '频道描述:', + 'admin_channel_slug' => 'SEO标题:', + 'admin_channel_threads' => '帖子数:', + 'admin_new_channel' => '新频道', + 'admin_add_channel' => '添加新频道', + 'admin_add_channel_success' => '频道创建成功!', + 'admin_reset_threads_trending' => '重置热门话题', 'admin_reset_threads_trending_success' => '重置热门话题成功!', ]; diff --git a/routes/web.php b/routes/web.php index 8968eff..e752d7a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -22,7 +22,7 @@ // 语言切换 Route::get('lang/{locale}', 'HomeController')->name('lang'); -Route::group(['prefix' => 'threads'], function (){ +Route::group(['prefix' => 'threads'], function () { // 帖子相关 Route::get('/', 'ThreadController@index'); Route::middleware('throttle:3')->post('/', 'ThreadController@store'); @@ -45,7 +45,7 @@ Route::post('/locked/{thread}', 'ThreadController@lock')->middleware('admin'); Route::post('/unlocked/{thread}', 'ThreadController@unlock')->middleware('admin'); -Route::group(['prefix' => 'replies'], function (){ +Route::group(['prefix' => 'replies'], function () { // 回复更新、删除与点赞 Route::get('/{reply}/edit', 'ReplyController@edit'); Route::patch('/{reply}', 'ReplyController@update'); @@ -55,7 +55,7 @@ Route::delete('/{reply}/favorites', 'FavoriteController@destroy'); }); -Route::group(['prefix' => 'profiles'], function (){ +Route::group(['prefix' => 'profiles'], function () { // 用户页 Route::get('/{user}', 'ProfileController@show')->name('profile'); Route::get('/{user}/notifications', 'ProfileController@all'); @@ -67,7 +67,7 @@ Route::get('search', 'SearchController@show')->name('user.search'); // 后台管理 -Route::group(['prefix' => 'admin', 'middleware' => 'admin', 'namespace' => 'Admin'], function() { +Route::group(['prefix' => 'admin', 'middleware' => 'admin', 'namespace' => 'Admin'], function () { Route::get('/', 'DashboardController@index')->name('admin.dashboard.index'); Route::post('/channel', 'ChannelController@store')->name('admin.channel.store'); Route::get('/channel', 'ChannelController@index')->name('admin.channel.index'); diff --git a/server.php b/server.php index 5fb6379..20bc389 100644 --- a/server.php +++ b/server.php @@ -1,12 +1,10 @@ */ - $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); diff --git a/tests/Feature/CreateThreadsTest.php b/tests/Feature/CreateThreadsTest.php index 431b6e1..9c4cb25 100644 --- a/tests/Feature/CreateThreadsTest.php +++ b/tests/Feature/CreateThreadsTest.php @@ -2,8 +2,6 @@ namespace Tests\Feature; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Foundation\Testing\WithFaker; use Laravel\Lumen\Testing\DatabaseMigrations; use Tests\TestCase; @@ -11,7 +9,7 @@ class CreateThreadsTest extends TestCase { use DatabaseMigrations; - function guest_may_not_create_threads() + public function guest_may_not_create_threads() { $this->expectException('Illuminate\Auth\AutheticationException'); @@ -20,7 +18,7 @@ function guest_may_not_create_threads() $this->post('threads', $thread->toArray()); } - function an_authenticated_user_can_create_new_forum_thread() + public function an_authenticated_user_can_create_new_forum_thread() { $this->actingAs(create('App\User')); diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index f31e495..8fbf370 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -3,7 +3,6 @@ namespace Tests\Feature; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase { diff --git a/tests/Feature/ParticipateInForum.php b/tests/Feature/ParticipateInForum.php index 3f74074..51fbc4b 100644 --- a/tests/Feature/ParticipateInForum.php +++ b/tests/Feature/ParticipateInForum.php @@ -2,8 +2,6 @@ namespace Tests\Feature; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Foundation\Testing\WithFaker; use Tests\TestCase; class ParticipateInForum extends TestCase @@ -15,12 +13,12 @@ class ParticipateInForum extends TestCase */ public function testExample() { - $user = factory('App\User')->create(); + $user = factory('App\User')->create(); - $thread = factory('App\Thread')->create(); + $thread = factory('App\Thread')->create(); - $reply = factory('App\Reply')->create(); + $reply = factory('App\Reply')->create(); - $this->post('threads/' . $thread->id . '/replies', $reply->toArray()); + $this->post('threads/'.$thread->id.'/replies', $reply->toArray()); } } diff --git a/tests/Feature/ThreadsTest.php b/tests/Feature/ThreadsTest.php index 951ff2b..ff37c5d 100644 --- a/tests/Feature/ThreadsTest.php +++ b/tests/Feature/ThreadsTest.php @@ -2,9 +2,8 @@ namespace Tests\Feature; -use phpDocumentor\Reflection\Types\Parent_; -use Tests\TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; +use Tests\TestCase; class ThreadsTest extends TestCase { @@ -12,13 +11,13 @@ class ThreadsTest extends TestCase public function setUp() { - Parent::setUp(); + parent::setUp(); $this->thread = factory('App\Thread')->create(); } /** - threads test + * threads test. */ public function index() { @@ -32,7 +31,7 @@ public function show() { //$thread = factory('App\Thread')->create(); - $response = $this->get('/threads/' . $this->thread->id); + $response = $this->get('/threads/'.$this->thread->id); $response->assertSee($this->thread->title); } } diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index e9fe19c..06ece2c 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -3,7 +3,6 @@ namespace Tests\Unit; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase { diff --git a/tests/Unit/ReplyTest.php b/tests/Unit/ReplyTest.php index 842121f..02e30c2 100644 --- a/tests/Unit/ReplyTest.php +++ b/tests/Unit/ReplyTest.php @@ -2,8 +2,8 @@ namespace Tests\Unit; -use PHPUnit\Framework\TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; +use PHPUnit\Framework\TestCase; class ReplyTest extends TestCase { diff --git a/tests/Unit/ThreadTest.php b/tests/Unit/ThreadTest.php index d2f2bb4..a1316b9 100644 --- a/tests/Unit/ThreadTest.php +++ b/tests/Unit/ThreadTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit; use Illuminate\Foundation\Testing\DatabaseMigrations; -use Tests\TestCase; + //use Illuminate\Foundation\Testing\RefreshDatabase; class ThreadTest @@ -17,21 +17,21 @@ public function setUP() $this->thread = create('App\Thread'); } - function a_thread_can_make_a_string_path() + public function a_thread_can_make_a_string_path() { $thread = make('App\Thread'); - $this->assertEquals('/threads/', $thread->channel->slug . '/' . $thread->id, $thread->path()); + $this->assertEquals('/threads/', $thread->channel->slug.'/'.$thread->id, $thread->path()); } - function threadReplies() + public function threadReplies() { $thread = factory('App\Thread')->create(); $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $thread->replies); } - function a_thread_has_a_creator() + public function a_thread_has_a_creator() { $this->assertInstanceOf('App\User', $thread->creator); }