From 7a93b44c6cb2f1e1f335d93ddf62a149ebd5f1d9 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 4 Jan 2016 23:20:50 +0100 Subject: Training app --- app/Http/Controllers/RandomVerbController.php | 30 +++++++++++++++++++++++++++ app/Http/routes.php | 12 ++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 app/Http/Controllers/RandomVerbController.php (limited to 'app/Http') diff --git a/app/Http/Controllers/RandomVerbController.php b/app/Http/Controllers/RandomVerbController.php new file mode 100644 index 0000000..e14d012 --- /dev/null +++ b/app/Http/Controllers/RandomVerbController.php @@ -0,0 +1,30 @@ + $val) { + $val = explode(',', $val); + $verbs = $verbs->filter(function(Verb $item) use ($col, $val) { + return in_array($item->getAttribute($col), $val); + }); + } + return $verbs->random(); + } + +} \ No newline at end of file diff --git a/app/Http/routes.php b/app/Http/routes.php index 5ecfcd1..5e6bc5a 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -12,5 +12,15 @@ */ $app->get('/', function () use ($app) { - return $app->welcome(); + return view('trainer'); }); + +$app->get('/stem', function () use ($app) { + return \HebrewParseTrainer\Stem::all(); +}); + +$app->get('/tense', function () use ($app) { + return \HebrewParseTrainer\Tense::all(); +}); + +$app->get('/verb/random', 'RandomVerbController@show'); -- cgit v1.2.3