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
fadeb1b9
Commit
fadeb1b9
authored
Oct 12, 2018
by
beardedwarrior
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add soft attribute for amount received, add more index display
parent
ee8d07de
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
10 deletions
+43
-10
app/Http/Controllers/FundingController.php
app/Http/Controllers/FundingController.php
+15
-6
app/Project.php
app/Project.php
+4
-0
database/migrations/2018_09_10_211659_create_deposits_table.php
...se/migrations/2018_09_10_211659_create_deposits_table.php
+1
-1
database/seeds/DatabaseSeeder.php
database/seeds/DatabaseSeeder.php
+1
-1
resources/views/projects/index.blade.php
resources/views/projects/index.blade.php
+20
-0
resources/views/projects/show.blade.php
resources/views/projects/show.blade.php
+0
-0
routes/web.php
routes/web.php
+2
-2
No files found.
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
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