Skip to content

Commit 5893780

Browse files
mckenzieartscybersoldattechStevyMarlinodependabot[bot]
authored
MEP | merge develop into main (#302)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Chri$ <[email protected]> Co-authored-by: Endaman Stevy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stevy Endaman <[email protected]>
1 parent 3413af6 commit 5893780

File tree

20 files changed

+359
-170
lines changed

20 files changed

+359
-170
lines changed

app/Filament/Resources/UserResource.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function table(Table $table): Table
5959
->placeholder('N/A')
6060
->date(),
6161
Tables\Columns\TextColumn::make(name: 'created_at')
62-
->label(__('use.inscription'))
62+
->label(__('user.inscription'))
6363
->date(),
6464
])
6565
->filters([
@@ -115,6 +115,38 @@ public static function table(Table $table): Table
115115
])
116116
->bulkActions([
117117
Tables\Actions\DeleteBulkAction::make(),
118+
Tables\Actions\BulkAction::make('delete_banned')
119+
->label(__('Supprimer les utilisateurs bannis'))
120+
->icon('heroicon-o-trash')
121+
->color('danger')
122+
->action(function ($records): void {
123+
124+
$bannedUsers = $records->whereNotNull('banned_at');
125+
126+
if ($bannedUsers->isEmpty()) {
127+
Notification::make()
128+
->warning()
129+
->title(__('actions.delete_none'))
130+
->duration(5000)
131+
->body(__('actions.delete_none_description'))
132+
->send();
133+
134+
return;
135+
}
136+
137+
$bannedUsers->each(function (User $user): void {
138+
$user->delete();
139+
});
140+
141+
Notification::make()
142+
->success()
143+
->title(__('actions.delete_success'))
144+
->duration(5000)
145+
->body(__('actions.delete_success_description'))
146+
->send();
147+
})
148+
->requiresConfirmation()
149+
->deselectRecordsAfterCompletion(),
118150
]);
119151
}
120152

app/Filament/Resources/UserResource/Pages/ListUsers.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public function getTabs(): array
1818
'all' => Tab::make(__('global.all')),
1919
'banned' => Tab::make(__('global.banned'))
2020
->modifyQueryUsing(fn ($query) => $query->isBanned()),
21-
'unbanned' => Tab::make(__('global.unbanned'))
22-
->modifyQueryUsing(fn ($query) => $query->isNotBanned()),
2321
];
2422
}
2523
}

app/Livewire/Components/ChangeLocale.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
final class ChangeLocale extends Component
1313
{
14-
public string $currentLocale;
14+
public ?string $currentLocale = null;
1515

1616
public function mount(): void
1717
{

app/Livewire/Pages/Articles/SinglePost.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ final class SinglePost extends Component
1414
{
1515
public Article $article;
1616

17-
public function mount(Article $article): void
17+
public function mount(): void
1818
{
1919
/** @var User $user */
2020
$user = Auth::user();
2121

22-
$article = $article->load(['media', 'user'])->loadCount('views');
22+
$article = $this->article->load(['media', 'user'])->loadCount('views');
2323

2424
abort_unless(
2525
$article->isPublished() || ($user && $article->isAuthoredBy($user)) || ($user && $user->hasAnyRole(['admin', 'moderator'])), // @phpstan-ignore-line
@@ -42,7 +42,6 @@ public function mount(Article $article): void
4242
->twitterTitle($article->title)
4343
->twitterDescription($article->excerpt(150))
4444
->twitterImage($image)
45-
->twitterSite('laravelcm')
4645
->url($article->canonicalUrl());
4746

4847
$this->article = $article;

app/Livewire/Pages/Discussions/SingleDiscussion.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@ final class SingleDiscussion extends Component implements HasActions, HasForms
2323

2424
public Discussion $discussion;
2525

26-
public function mount(Discussion $discussion): void
26+
public function mount(): void
2727
{
28-
views($discussion)->cooldown(now()->addHours(2))->record();
28+
views($this->discussion)->cooldown(now()->addHours(2))->record();
2929

3030
// @phpstan-ignore-next-line
3131
seo()
32-
->title($discussion->title)
33-
->description($discussion->excerpt(100))
32+
->title($this->discussion->title)
33+
->description($this->discussion->excerpt(100))
3434
->image(asset('images/socialcard.png'))
35-
->twitterTitle($discussion->title)
36-
->twitterDescription($discussion->excerpt(100))
37-
->twitterImage(asset('images/socialcard.png'))
38-
->twitterSite('laravelcm')
35+
->twitterTitle($this->discussion->title)
36+
->twitterDescription($this->discussion->excerpt(100))
3937
->withUrl();
4038

41-
$this->discussion = $discussion->load('tags', 'replies', 'reactions', 'replies.user');
39+
$this->discussion->load('tags', 'replies', 'reactions', 'replies.user', 'user');
4240
}
4341

4442
public function editAction(): Action

app/Livewire/Pages/Home.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ public function render(): View
1919
{
2020
$ttl = now()->addDays(2);
2121

22-
// @phpstan-ignore-next-line
23-
seo()
24-
->description(__('pages/home.description'))
25-
->twitterDescription(__('pages/home.description'))
26-
->image(asset('/images/socialcard.png'))
27-
->twitterSite('laravelcm')
28-
->withUrl();
29-
3022
return view('livewire.pages.home', [
3123
'plans' => Cache::remember(
3224
key: 'plans',

app/Models/User.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ final class User extends Authenticatable implements FilamentUser, HasAvatar, Has
117117
'last_active_at' => 'datetime',
118118
];
119119

120+
protected $with = [
121+
'providers',
122+
];
123+
120124
public function hasProvider(string $provider): bool
121125
{
122126
foreach ($this->providers as $p) {

app/Providers/AppServiceProvider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ public function boot(): void
4040
$this->bootEloquentMorphs();
4141
$this->bootFilament();
4242

43+
// @phpstan-ignore-next-line
44+
seo()
45+
->title(
46+
default: __('pages/home.title'),
47+
modify: fn (string $title) => $title.' | '.__('global.site_name')
48+
)
49+
->description(default: __('global.site_description'))
50+
->image(default: fn () => asset('images/socialcard.png'))
51+
->twitterSite('@laravelcm');
52+
4353
FilamentColor::register([
4454
'primary' => Color::Emerald,
4555
'danger' => Color::Red,

app/View/Composers/InactiveDiscussionsComposer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public function compose(View $view): void
1414
{
1515
$discussions = Cache::remember(
1616
key: 'inactive_discussions',
17-
ttl: now()->addDays(3),
18-
callback: fn () => Discussion::noComments()->limit(5)->get()
17+
ttl: now()->addWeek(),
18+
callback: fn () => Discussion::with('user')->noComments()->limit(5)->get()
1919
);
2020

2121
$view->with('discussions', $discussions);

app/View/Composers/TopContributorsComposer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public function compose(View $view): void
1515
$topContributors = Cache::remember(
1616
key: 'contributors',
1717
ttl: now()->addWeek(),
18-
callback: fn () => User::topContributors()
18+
callback: fn () => User::query()->scopes('topContributors')
1919
->get()
20-
->filter(fn (User $contributor) => $contributor->loadCount('discussions')->discussions_count >= 1)
20+
->filter(fn (User $contributor) => $contributor->discussions_count >= 1)
2121
->take(5)
2222
);
2323

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ext-json": "*",
1111
"archtechx/laravel-seo": "^0.10",
1212
"awcodes/filament-badgeable-column": "^2.3",
13+
"barryvdh/laravel-debugbar": "^3.14",
1314
"blade-ui-kit/blade-heroicons": "^2.4",
1415
"codeat3/blade-phosphor-icons": "^2.0",
1516
"cyrildewit/eloquent-viewable": "^7.0",

0 commit comments

Comments
 (0)