Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Learning and Work
managing-money-api
Commits
ccf14471
Commit
ccf14471
authored
Jun 27, 2018
by
Jack Stupple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add currencies endpoint
parent
6db0a10f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
app/Http/Controllers/Api/CurrencyController.php
app/Http/Controllers/Api/CurrencyController.php
+15
-0
routes/api.php
routes/api.php
+8
-0
No files found.
app/Http/Controllers/Api/CurrencyController.php
0 → 100644
View file @
ccf14471
<?php
namespace
App\Http\Controllers\Api
;
class
CurrencyController
extends
Controller
{
public
function
index
()
{
// raw because <= NOW() is mysql directly into the function and the builder will misunderstand it otherwise
return
\
App\Currency
::
all
();
}
public
function
default
()
{
return
\
App\Currency
::
where
(
'currency_code'
,
'EUR'
)
->
first
();
}
}
\ No newline at end of file
routes/api.php
View file @
ccf14471
...
...
@@ -22,6 +22,14 @@ $router->group(
}
);
$router
->
group
(
[
'prefix'
=>
'currencies'
],
function
()
use
(
$router
)
{
$router
->
get
(
'/'
,
'CurrencyController@index'
);
$router
->
get
(
'/default'
,
'CurrencyController@default'
);
}
);
$router
->
group
(
[
'prefix'
=>
'characters'
],
function
()
use
(
$router
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment