Skip to content

Commit 719133d

Browse files
committed
optimisation des requetes dans les traits
1 parent bf602a3 commit 719133d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/Traits/HasProfilePhoto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function getProfilePhotoUrlAttribute(): string
1515
return $this->getFirstMediaUrl('avatar');
1616
}
1717

18-
$social_avatar = $this->providers()->where('provider', $this->avatar_type)->first();
18+
$social_avatar = $this->providers->where('provider', $this->avatar_type)->first();
1919

2020
if ($social_avatar && strlen($social_avatar->avatar)) {
2121
return $social_avatar->avatar;

app/Traits/WithArticleAttributes.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ trait WithArticleAttributes
1010
public ?string $slug = null;
1111
public string $body = '';
1212
public ?string $canonical_url = null;
13-
public bool $show_toc = true;
14-
public bool $submitted = true;
13+
public bool $show_toc = false;
1514
public ?string $submitted_at = null;
1615
public ?string $approved_at = null;
1716
public $file;
1817

1918
protected $rules = [
20-
'title' => ['required', 'max:150'],
21-
'body' => ['required'],
19+
'title' => 'required|max:150',
20+
'body' => 'required',
2221
'tags_selected' => 'nullable|array',
2322
'canonical_url' => 'nullable|url',
2423
'file' => 'nullable|image|max:2048', // 1MB Max

0 commit comments

Comments
 (0)