File tree Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Expand file tree Collapse file tree 5 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 6
6
use App \Models \Tag ;
7
7
use App \Traits \WithInfiniteScroll ;
8
8
use App \Traits \WithTags ;
9
+ use Illuminate \Contracts \View \View ;
9
10
use Livewire \Component ;
10
11
11
12
class Browse extends Component
@@ -26,7 +27,7 @@ public function validSort($sort): bool
26
27
]);
27
28
}
28
29
29
- public function render ()
30
+ public function render (): View
30
31
{
31
32
$ articles = Article::with ('tags ' )->published ()
32
33
->notPinned ()
Original file line number Diff line number Diff line change 6
6
use App \Models \Tag ;
7
7
use App \Traits \WithInfiniteScroll ;
8
8
use App \Traits \WithTags ;
9
+ use Illuminate \Contracts \View \View ;
9
10
use Livewire \Component ;
10
11
11
12
class Browse extends Component
@@ -17,7 +18,7 @@ class Browse extends Component
17
18
'sortBy ' => ['except ' => 'recent ' ],
18
19
];
19
20
20
- public function validSort ($ sort ): bool
21
+ public function validSort (string $ sort ): bool
21
22
{
22
23
return in_array ($ sort , [
23
24
'recent ' ,
@@ -26,7 +27,7 @@ public function validSort($sort): bool
26
27
]);
27
28
}
28
29
29
- public function render ()
30
+ public function render (): View
30
31
{
31
32
$ discussions = Discussion::with ('tags ' )
32
33
->withCount ('replies ' )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ trait WithInfiniteScroll
10
10
11
11
public int $ perPage = 10 ;
12
12
13
- public function loadMore ()
13
+ public function loadMore (): void
14
14
{
15
15
$ this ->perPage += 10 ;
16
16
}
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ trait WithTags
10
10
11
11
public string $ sortBy = 'recent ' ;
12
12
13
- public function toggleTag ($ tag ): void
13
+ public function toggleTag (string $ tag ): void
14
14
{
15
15
$ this ->tag = $ this ->tag !== $ tag && $ this ->tagExists ($ tag ) ? $ tag : null ;
16
16
}
17
17
18
- public function sortBy ($ sort ): void
18
+ public function sortBy (string $ sort ): void
19
19
{
20
20
$ this ->sortBy = $ this ->validSort ($ sort ) ? $ sort : 'recent ' ;
21
21
}
Original file line number Diff line number Diff line change 7
7
8
8
class DiscussionFactory extends Factory
9
9
{
10
- public function definition ()
10
+ /**
11
+ * Define the model's default state.
12
+ *
13
+ * @return array<string, mixed>
14
+ */
15
+ public function definition (): array
11
16
{
12
17
return [
13
18
'user_id ' => $ attributes ['user_id ' ] ?? User::factory (),
You can’t perform that action at this time.
0 commit comments