109 lines
2.5 KiB
PHP
109 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Payment;
|
|
use App\Models\User;
|
|
|
|
class PaymentController extends Controller
|
|
{
|
|
public function __construct() {
|
|
// Staff Permission Check
|
|
$this->middleware(['permission:seller_payment_history'])->only('payment_histories');
|
|
}
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
// public function index()
|
|
// {
|
|
// $payments = Payment::where('seller_id', Auth::user()->seller->id)->paginate(9);
|
|
// return view('seller.payment_history', compact('payments'));
|
|
// }
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function payment_histories(Request $request)
|
|
{
|
|
$payments = Payment::orderBy('created_at', 'desc')->paginate(15);
|
|
return view('backend.sellers.payment_histories.index', compact('payments'));
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($id)
|
|
{
|
|
$user = User::find(decrypt($id));
|
|
$payments = Payment::where('seller_id', $user->id)->orderBy('created_at', 'desc')->get();
|
|
if($payments->count() > 0){
|
|
return view('backend.sellers.payment', compact('payments', 'user'));
|
|
}
|
|
flash(translate('No payment history available for this seller'))->warning();
|
|
return back();
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|