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
238c82b7
Commit
238c82b7
authored
Dec 31, 2018
by
beardedwarrior
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the additional fields to the projects
parent
cf1f9603
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
app/Project.php
app/Project.php
+6
-5
database/factories/ProjectFactory.php
database/factories/ProjectFactory.php
+4
-0
database/migrations/2018_09_10_211623_create_projects_table.php
...se/migrations/2018_09_10_211623_create_projects_table.php
+3
-0
No files found.
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