99use App \Models \Indicator ;
1010use App \Models \StudyCase ;
1111use Livewire \WithPagination ;
12+ use App \Enums \StudyCaseStatus ;
1213
1314class SearchCases extends Component
1415{
@@ -31,33 +32,33 @@ class SearchCases extends Component
3132 public function mount ()
3233 {
3334 // Retrieve all cases and the related languages, tags, and countries
34- $ this ->cases = StudyCase::where ('reviewed ' , 1 )
35+ $ this ->cases = StudyCase::where ('status ' , StudyCaseStatus::Reviewed )
3536 ->orderBy ('order ' , 'asc ' )
3637 ->get ();
3738 $ this ->caseCount = $ this ->cases ->count ();
3839
3940 // Retrieve languages, tags, and countries that have related reviewed cases
4041 $ this ->languages = Language::whereHas ('studyCases ' , function ($ query ) {
41- $ query ->where ('reviewed ' , 1 );
42+ $ query ->where ('status ' , StudyCaseStatus::Reviewed );
4243 })->orderBy ('name ' )->get ();
4344
4445 $ this ->tags = Tag::whereHas ('studyCases ' , function ($ query ) {
45- $ query ->where ('reviewed ' , 1 );
46+ $ query ->where ('status ' , StudyCaseStatus::Reviewed );
4647 })->orderBy ('name ' )->get ();
4748
4849 $ this ->indicators = Indicator::whereHas ('evidence.claim.studyCase ' , function ($ query ) {
49- $ query ->where ('reviewed ' , 1 );
50+ $ query ->where ('status ' , StudyCaseStatus::Reviewed );
5051 })->orderBy ('name ' )->get ();
5152
5253 $ this ->countries = Country::whereHas ('studyCases ' , function ($ query ) {
53- $ query ->where ('reviewed ' , 1 );
54+ $ query ->where ('status ' , StudyCaseStatus::Reviewed );
5455 })->orderBy ('name ' )->get ();
5556 }
5657
5758 public function searchCases ()
5859 {
5960 // Setup the query and only retrieve reviewed cases
60- $ query = StudyCase::query ()->where ('reviewed ' , 1 );
61+ $ query = StudyCase::query ()->where ('status ' , StudyCaseStatus::Reviewed );
6162
6263 // Handle the search term (if present)
6364 if ($ this ->query ) {
0 commit comments