Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
monero-project
CCS Backend
Commits
8304a44a
Commit
8304a44a
authored
Oct 12, 2018
by
beardedwarrior
Browse files
added more detail to the project page, percentage, number of contributions and total requested
parent
ded0e69b
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/FundingController.php
View file @
8304a44a
...
...
@@ -21,7 +21,16 @@ class FundingController extends Controller
public
function
show
(
$paymentId
)
{
$project
=
Project
::
where
(
'payment_id'
,
$paymentId
)
->
first
();
if
(
!
$project
)
{
abort
(
404
);
}
$contributions
=
$project
->
deposits
->
count
();
$amountReceived
=
$project
->
deposits
->
sum
(
'amount'
);
$percentage
=
round
(
$amountReceived
/
$project
->
target_amount
*
100
);
return
view
(
'ffs'
)
->
with
(
'amount_received'
,
$project
->
deposts
->
sum
(
'amount'
));
->
with
(
'project'
,
$project
)
->
with
(
'contributions'
,
$contributions
)
->
with
(
'percentage'
,
$percentage
)
->
with
(
'amount_received'
,
$amountReceived
);
}
}
app/Project.php
View file @
8304a44a
...
...
@@ -11,6 +11,6 @@ class Project extends Model
*/
public
function
deposits
()
{
return
$this
->
hasMany
(
Deposit
::
class
);
return
$this
->
hasMany
(
Deposit
::
class
,
'payment_id'
,
'payment_id'
);
}
}
resources/views/ffs.blade.php
View file @
8304a44a
{{
amount_received
}}
\ No newline at end of file
XMR
{{
$amount_received
}}
/
XMR
{{
$project
->
target_amount
}}
Target
{{
$contributions
}}
contributions
made
.
{{
$percentage
}}
%
\ No newline at end of file
routes/web.php
View file @
8304a44a
...
...
@@ -15,4 +15,4 @@ Route::get('/', function () {
return
view
(
'welcome'
);
});
Route
::
get
(
'project/{paymentId}'
,
[
'as'
=>
'ffs'
,
'uses'
=>
\
App\Http\Controllers\
FundingController
::
class
.
'@show'
]);
Route
::
get
(
'project/{paymentId}'
,
[
'as'
=>
'ffs'
,
'uses'
=>
FundingController
::
class
.
'@show'
]);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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