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
fadeb1b9
Commit
fadeb1b9
authored
Oct 12, 2018
by
beardedwarrior
Browse files
add soft attribute for amount received, add more index display
parent
ee8d07de
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/FundingController.php
View file @
fadeb1b9
...
...
@@ -9,12 +9,21 @@ use Illuminate\Http\Request;
class
FundingController
extends
Controller
{
/**
*
Generates the interstitial
*
Shows all projects
*
* @param $invoice
* @param null $currency
* @param bool $moneroOnly
* @param bool $shopifySite
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
*/
public
function
index
()
{
$projects
=
Project
::
all
();
return
view
(
'projects.index'
)
->
with
(
'projects'
,
$projects
);
}
/**
* Shows the project based on the payment id
*
* @param $paymentId
*
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
*/
...
...
@@ -27,7 +36,7 @@ class FundingController extends Controller
$contributions
=
$project
->
deposits
->
count
();
$amountReceived
=
$project
->
deposits
->
sum
(
'amount'
);
$percentage
=
round
(
$amountReceived
/
$project
->
target_amount
*
100
);
return
view
(
'
ffs
'
)
return
view
(
'
projects.show
'
)
->
with
(
'project'
,
$project
)
->
with
(
'contributions'
,
$contributions
)
->
with
(
'percentage'
,
$percentage
)
...
...
app/Project.php
View file @
fadeb1b9
...
...
@@ -13,4 +13,8 @@ class Project extends Model
{
return
$this
->
hasMany
(
Deposit
::
class
,
'payment_id'
,
'payment_id'
);
}
public
function
getAmountReceivedAttribute
()
{
return
$this
->
deposits
->
sum
(
'amount'
);
}
}
database/migrations/2018_09_10_211659_create_deposits_table.php
View file @
fadeb1b9
...
...
@@ -17,7 +17,7 @@ class CreateDepositsTable extends Migration
$table
->
increments
(
'id'
);
$table
->
string
(
'payment_id'
);
$table
->
string
(
'amount'
);
$table
->
unsignedInteger
(
'time_received'
);
$table
->
dateTime
(
'time_received'
);
$table
->
string
(
'tx_id'
);
$table
->
unsignedInteger
(
'block_received'
);
$table
->
timestamps
();
...
...
database/seeds/DatabaseSeeder.php
View file @
fadeb1b9
...
...
@@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
*/
public
function
run
()
{
//
$this->call(
User
sTableSeeder::class);
$this
->
call
(
Project
sTableSeeder
::
class
);
}
}
resources/views/projects/index.blade.php
0 → 100644
View file @
fadeb1b9
<table>
<thead
class=
"flip-content"
>
<tr>
<th>
Payment ID
</th>
<th>
Status
</th>
<th>
Funding Received
</th>
<th>
Required
</th>
</tr>
</thead>
<tbody>
@foreach ($projects as $project)
<tr>
<td><a
href=
'{!! url('
/
projects
/'.$
project-
>
payment_id); !!}'>{{ $project->payment_id }}
</a></td>
<td>
{{$project->status}}
</td>
<td>
{{$project->amountReceived}} XMR
</td>
<td>
{{$project->target_amount}} XMR
</td>
</tr>
@endforeach
</tbody>
</table>
\ No newline at end of file
resources/views/
ffs
.blade.php
→
resources/views/
projects/show
.blade.php
View file @
fadeb1b9
File moved
routes/web.php
View file @
fadeb1b9
...
...
@@ -14,5 +14,5 @@
Route
::
get
(
'/'
,
function
()
{
return
view
(
'welcome'
);
});
Route
::
get
(
'project/{paymentId}'
,
[
'as'
=>
'ffs'
,
'uses'
=>
FundingController
::
class
.
'@show'
]);
Route
::
get
(
'projects'
,
[
'as'
=>
'ffs'
,
'uses'
=>
FundingController
::
class
.
'@index'
]);
Route
::
get
(
'project
s
/{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