Donations page is added.

master
yunusemre 5 years ago
parent 67cc77ddf6
commit 91964a282f
  1. 6
      app/Http/Controllers/DonationController.php
  2. 2
      app/Providers/RouteServiceProvider.php
  3. 8
      app/User.php
  4. 35
      resources/views/donations.blade.php
  5. 1
      routes/web.php

@ -178,4 +178,10 @@ class DonationController extends Controller
$donation = Donation::where('conversation_id', $conversation_id)->firstOrFail();
return view('success', compact('donation'));
}
public function all(Request $request)
{
$donations = $request->user()->donations()->latest()->paginate();
return view('donations', compact('donations'));
}
}

@ -21,7 +21,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
public const HOME = '/home';
public const HOME = '/donations';
/**
* Define your route model bindings, pattern filters, etc.

@ -5,7 +5,7 @@ namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use App\Donation;
class User extends Authenticatable
{
use Notifiable;
@ -36,4 +36,10 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
];
public function donations()
{
return $this->hasMany(Donation::class);
}
}

@ -0,0 +1,35 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<table class="table table-hover">
<thead class="bg-primary text-white" style="border-radius: 50px;">
<tr>
<th scope="col">Amount</th>
<th scope="col">Transaction Date</th>
<th scope="col">Frequency</th>
<th scope="col">Next Payment Date</th>
</tr>
</thead>
<tbody>
@foreach($donations as $donation)
<tr>
<th >{{$donation->amount}} {{$donation->currency}}</th>
<td>{{$donation->created_at}}</td>
<td>{{ucfirst($donation->frequency)}}</td>
<td>{{$donation->next_payment_at}}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="d-flex justify-content-center">
{{$donations->links()}}
</div>
</div>
</div>
</div>
</div>
@endsection

@ -19,4 +19,5 @@ Route::get('/', 'DonationController@index')->name('donation.form');
Route::post('/make-donation', 'DonationController@donate')->name('donation.make');
Route::get('/success/{conversation_id}', 'DonationController@success')->name('donation.success');
Route::view('/privacy-policy', 'pages.privacypolicy')->name('pages.privacypolicy');
Route::get('/donations', 'DonationController@all')->name('donations');
Route::get('/home', 'HomeController@index')->name('home');

Loading…
Cancel
Save