Skip to content
Snippets Groups Projects
Commit edf0d4fb authored by beardedwarrior's avatar beardedwarrior
Browse files

added qrcode to the show page

parent fd0ad8a4
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......@@ -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;
}
}
......@@ -4,7 +4,6 @@ namespace Monero;
use App\Project;
use Carbon\Carbon;
use jsonRPCClient;
class Wallet
{
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment