Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
CCS Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiphon
CCS Backend
Commits
fa1683dd
Commit
fa1683dd
authored
Aug 12, 2019
by
xiphon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api: fix 'projects' endpoint, don't paginate, always return JSON
parent
52f534f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
app/Http/Controllers/FundingController.php
app/Http/Controllers/FundingController.php
+1
-8
app/Http/Resources/ProjectResource.php
app/Http/Resources/ProjectResource.php
+7
-5
No files found.
app/Http/Controllers/FundingController.php
View file @
fa1683dd
...
...
@@ -17,14 +17,7 @@ class FundingController extends Controller
*/
public
function
index
(
Request
$request
)
{
$projects
=
Project
::
paginate
(
15
);
// If the request has header `Accept: */json`, return JSON
if
(
$request
->
wantsJson
())
{
return
ProjectResource
::
collection
(
$projects
);
}
return
view
(
'projects.index'
)
->
with
(
'projects'
,
$projects
);
return
ProjectResource
::
collection
(
Project
::
all
());
}
/**
...
...
app/Http/Resources/ProjectResource.php
View file @
fa1683dd
...
...
@@ -15,13 +15,15 @@ class ProjectResource extends JsonResource
public
function
toArray
(
$request
)
{
return
[
'subaddr_index'
=>
$this
->
subaddr_index
,
'status'
=>
$this
->
status
,
'address'
=>
$this
->
address
,
'author'
=>
$this
->
author
,
'contributions'
=>
$this
->
contributions
,
'date'
=>
$this
->
created_at
->
format
(
'F j, Y'
),
'percentage_funded'
=>
$this
->
percentage_funded
,
'raised_amount'
=>
$this
->
raised_amount
,
'state'
=>
$this
->
state
,
'target_amount'
=>
$this
->
target_amount
,
'percentage_funded'
=>
$this
->
percentage_funded
,
'qrcode'
=>
[
'base64'
=>
base64_encode
(
$this
->
qrcode
)],
'contributions'
=>
$this
->
contributions
,
'title'
=>
$this
->
title
,
];
}
}
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