Skip to content
GitLab
Menu
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
238c82b7
Commit
238c82b7
authored
Dec 31, 2018
by
beardedwarrior
Browse files
added the additional fields to the projects
parent
cf1f9603
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/Project.php
View file @
238c82b7
...
...
@@ -51,10 +51,6 @@ class Project extends Model
return
$this
->
deposits
->
sum
(
'amount'
);
}
public
function
getUriAttribute
()
{
return
'monero:'
.
env
(
'WALLET_ADDRESS'
)
.
'tx_payment_id='
.
$this
->
payment_id
;
}
public
function
getPercentageFundedAttribute
()
{
return
round
(
$this
->
amount_received
/
$this
->
target_amount
*
100
);
}
...
...
@@ -63,7 +59,12 @@ class Project extends Model
return
$this
->
deposits
->
count
()
??
0
;
}
public
function
ge
tQrcodeAttribut
e
()
{
public
function
ge
nerateQrcod
e
()
{
return
QrCode
::
format
(
'png'
)
->
size
(
500
)
->
generate
(
$this
->
uri
);
}
public
function
getQrCodeSrcAttribute
()
{
$encoded
=
base64_encode
(
$this
->
generateQrcode
());
return
"data:image/png;base64,
{
$encoded
}
"
;
}
}
database/factories/ProjectFactory.php
View file @
238c82b7
...
...
@@ -8,7 +8,11 @@ $factory->define(\App\Project::class, function (Faker $faker) {
return
[
'title'
=>
$faker
->
sentence
(),
'payment_id'
=>
$faker
->
sha256
,
'address'
=>
$faker
->
sha256
,
'address_uri'
=>
"monero:
{
$faker
->
sha256
}
"
,
'qr_code'
=>
$faker
->
file
(),
'target_amount'
=>
$faker
->
randomFloat
(
2
,
0
,
2000
),
'raised_amount'
=>
$faker
->
randomFloat
(
2
,
0
,
2000
),
'state'
=>
$state
,
'merge_request_id'
=>
$faker
->
randomNumber
(
6
),
'gitlab_username'
=>
$faker
->
userName
,
...
...
database/migrations/2018_09_10_211623_create_projects_table.php
View file @
238c82b7
...
...
@@ -18,7 +18,10 @@ class CreateProjectsTable extends Migration
$table
->
string
(
'title'
);
$table
->
string
(
'payment_id'
)
->
nullable
();
$table
->
string
(
'address'
)
->
nullable
();
$table
->
string
(
'address_uri'
)
->
nullable
();
$table
->
string
(
'qr_code'
)
->
nullable
();
$table
->
string
(
'target_amount'
)
->
nullable
();
$table
->
string
(
'raised_amount'
)
->
nullable
();
$table
->
string
(
'state'
)
->
default
(
'OPENED'
);
$table
->
string
(
'filename'
)
->
nullable
();
$table
->
unsignedInteger
(
'merge_request_id'
)
->
unique
();
...
...
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