mirror of https://github.com/pixelfed/pixelfed
Add Profile Sponsors
parent
ae58298f9f
commit
bcfbb0299c
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\ProfileSponsor;
|
||||
use Auth;
|
||||
|
||||
class ProfileSponsorController extends Controller
|
||||
{
|
||||
public function get(Request $request, $id)
|
||||
{
|
||||
$res = ProfileSponsor::whereProfileId($id)->firstOrFail()->sponsors;
|
||||
return response($res)->header('Content-Type', 'application/json');
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProfileSponsor extends Model
|
||||
{
|
||||
public $fillable = ['profile_id'];
|
||||
|
||||
public function profile()
|
||||
{
|
||||
return $this->belongsTo(Profile::class);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateProfileSponsorsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('profile_sponsors', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->bigInteger('profile_id')->unsigned()->unique()->index();
|
||||
$table->json('sponsors')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('profile_sponsors');
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
||||
@extends('settings.template')
|
||||
|
||||
@section('section')
|
||||
|
||||
<div class="title">
|
||||
<h3 class="font-weight-bold">Sponsor</h3>
|
||||
<p class="lead">Add crowdfunding links to your profile.</p>
|
||||
</div>
|
||||
<hr>
|
||||
<form method="post" action="{{route('settings.sponsor')}}">
|
||||
@csrf
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="patreon" class="col-sm-3 col-form-label font-weight-bold text-right">Patreon</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="patreon" name="patreon" placeholder="patreon.com/dansup" value="{{$sponsors['patreon']}}">
|
||||
<p class="help-text small text-muted font-weight-bold">
|
||||
Example: patreon.com/dansup
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="liberapay" class="col-sm-3 col-form-label font-weight-bold text-right">Liberapay</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="liberapay" name="liberapay" placeholder="liberapay.com/pixelfed" value="{{$sponsors['liberapay']}}">
|
||||
<p class="help-text small text-muted font-weight-bold">
|
||||
Example: liberapay.com/pixelfed
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="opencollective" class="col-sm-3 col-form-label font-weight-bold text-right">OpenCollective</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="opencollective" name="opencollective" placeholder="opencollective.com/pixelfed" value="{{$sponsors['opencollective']}}">
|
||||
<p class="help-text small text-muted font-weight-bold">
|
||||
Example: opencollective.com/pixelfed
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group row">
|
||||
<div class="col-12 text-right">
|
||||
<button type="submit" class="btn btn-primary font-weight-bold float-right">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@endsection
|
Loading…
Reference in New Issue