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
edf0d4fb
Commit
edf0d4fb
authored
Oct 12, 2018
by
beardedwarrior
Browse files
added qrcode to the show page
parent
fd0ad8a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/FundingController.php
View file @
edf0d4fb
...
...
@@ -5,6 +5,8 @@ namespace App\Http\Controllers;
use
App\Deposit
;
use
App\Project
;
use
Illuminate\Http\Request
;
use
Monero\Wallet
;
use
SimpleSoftwareIO\QrCode\Facades\QrCode
;
class
FundingController
extends
Controller
{
...
...
@@ -36,10 +38,12 @@ class FundingController extends Controller
$contributions
=
$project
->
deposits
->
count
();
$amountReceived
=
$project
->
deposits
->
sum
(
'amount'
);
$percentage
=
round
(
$amountReceived
/
$project
->
target_amount
*
100
);
$qrcode
=
QrCode
::
format
(
'png'
)
->
size
(
100
)
->
generate
(
$project
->
uri
);
return
view
(
'projects.show'
)
->
with
(
'project'
,
$project
)
->
with
(
'contributions'
,
$contributions
)
->
with
(
'percentage'
,
$percentage
)
->
with
(
'qrcode'
,
$qrcode
)
->
with
(
'amount_received'
,
$amountReceived
);
}
}
app/Project.php
View file @
edf0d4fb
...
...
@@ -3,6 +3,7 @@
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
use
Monero\Wallet
;
/**
* App\Project
...
...
@@ -15,6 +16,7 @@ use Illuminate\Database\Eloquent\Model;
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Deposit[] $deposits
* @property-read mixed $amount_received
* @property-read string $uri
* @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Project wherePaymentId($value)
...
...
@@ -36,4 +38,8 @@ class Project extends Model
public
function
getAmountReceivedAttribute
()
{
return
$this
->
deposits
->
sum
(
'amount'
);
}
public
function
getUriAttribute
()
{
return
'monero:'
.
env
(
'WALLET_ADDRESS'
)
.
'tx_payment_id='
.
$this
->
payment_id
;
}
}
monero/Wallet.php
View file @
edf0d4fb
...
...
@@ -4,7 +4,6 @@ namespace Monero;
use
App\Project
;
use
Carbon\Carbon
;
use
jsonRPCClient
;
class
Wallet
{
...
...
resources/views/projects/show.blade.php
View file @
edf0d4fb
XMR
{{
$amount_received
}}
/
XMR
{{
$project
->
target_amount
}}
Target
{{
$contributions
}}
contributions
made
.
{{
$percentage
}}
%
\ No newline at end of file
{{
$contributions
}}
contributions
made
.
{{
$percentage
}}
%
<
br
>
{
!!
QrCode
::
size
(
400
)
->
generate
(
$project
->
uri
);
!!
}
\ No newline at end of file
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