Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 78 #10

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions app/Http/Controllers/Api/TestApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,26 @@ public function getTestsList()
header('Content-type: application/json');
echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
public function search(Request $request)
{
$s = $request->$s;
$testsearch = Test::where('name', 'LIKE', '%{$s}%');
if ($testsearch) {
$response = [
"success" => true,
"testsearch" => $testsearch,
];
} else {
$response = [
"success" => false,
"error" => "Can't find tests",
];
}

header('Content-type: application/json');
echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}

public function getTest(Request $request)
{
$testId = $request->input('id');
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/ReactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public function index()
{
return view('react');
}

}
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
*/

Route::get('/{page?}/{theme?}/{id?}',[ReactController::class, 'index']);
Route::get('/search',[ReactController::class, 'search']);