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 66use App \Models \Tag ;
77use App \Traits \WithInfiniteScroll ;
88use App \Traits \WithTags ;
9+ use Illuminate \Contracts \View \View ;
910use Livewire \Component ;
1011
1112class Browse extends Component
@@ -26,7 +27,7 @@ public function validSort($sort): bool
2627 ]);
2728 }
2829
29- public function render ()
30+ public function render (): View
3031 {
3132 $ articles = Article::with ('tags ' )->published ()
3233 ->notPinned ()
Original file line number Diff line number Diff line change 66use App \Models \Tag ;
77use App \Traits \WithInfiniteScroll ;
88use App \Traits \WithTags ;
9+ use Illuminate \Contracts \View \View ;
910use Livewire \Component ;
1011
1112class Browse extends Component
@@ -17,7 +18,7 @@ class Browse extends Component
1718 'sortBy ' => ['except ' => 'recent ' ],
1819 ];
1920
20- public function validSort ($ sort ): bool
21+ public function validSort (string $ sort ): bool
2122 {
2223 return in_array ($ sort , [
2324 'recent ' ,
@@ -26,7 +27,7 @@ public function validSort($sort): bool
2627 ]);
2728 }
2829
29- public function render ()
30+ public function render (): View
3031 {
3132 $ discussions = Discussion::with ('tags ' )
3233 ->withCount ('replies ' )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ trait WithInfiniteScroll
1010
1111 public int $ perPage = 10 ;
1212
13- public function loadMore ()
13+ public function loadMore (): void
1414 {
1515 $ this ->perPage += 10 ;
1616 }
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ trait WithTags
1010
1111 public string $ sortBy = 'recent ' ;
1212
13- public function toggleTag ($ tag ): void
13+ public function toggleTag (string $ tag ): void
1414 {
1515 $ this ->tag = $ this ->tag !== $ tag && $ this ->tagExists ($ tag ) ? $ tag : null ;
1616 }
1717
18- public function sortBy ($ sort ): void
18+ public function sortBy (string $ sort ): void
1919 {
2020 $ this ->sortBy = $ this ->validSort ($ sort ) ? $ sort : 'recent ' ;
2121 }
Original file line number Diff line number Diff line change 77
88class DiscussionFactory extends Factory
99{
10- public function definition ()
10+ /**
11+ * Define the model's default state.
12+ *
13+ * @return array<string, mixed>
14+ */
15+ public function definition (): array
1116 {
1217 return [
1318 'user_id ' => $ attributes ['user_id ' ] ?? User::factory (),
You can’t perform that action at this time.
0 commit comments