Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
beardedwarrior
ffs
Commits
8304a44a
Commit
8304a44a
authored
Oct 12, 2018
by
beardedwarrior
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
4 changed files
with
15 additions
and
4 deletions
+15
-4
app/Http/Controllers/FundingController.php
app/Http/Controllers/FundingController.php
+10
-1
app/Project.php
app/Project.php
+1
-1
resources/views/ffs.blade.php
resources/views/ffs.blade.php
+3
-1
routes/web.php
routes/web.php
+1
-1
No files found.
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
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