mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-29 11:15:58 +00:00
setup wizard init
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Http\Resources\InvoiceAdminCollection;
|
||||
use App\Http\Resources\InvoiceResource;
|
||||
use App\Invoice;
|
||||
use App\Services\StripeService;
|
||||
use App\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
@@ -40,9 +41,11 @@ class InvoiceController extends Controller
|
||||
*/
|
||||
public function show($customer, $token)
|
||||
{
|
||||
$settings = json_decode(Setting::all()->pluck('value', 'name')->toJson());
|
||||
$invoice = $this->stripe->getUserInvoice($customer, $token);
|
||||
|
||||
return view('vuefilemanager.invoice')
|
||||
->with('settings', $settings)
|
||||
->with('invoice', $invoice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ class UserController extends Controller
|
||||
*
|
||||
* @return InvoiceCollection
|
||||
*/
|
||||
public function invoices()
|
||||
public function invoices($id)
|
||||
{
|
||||
$user = \Auth::user();
|
||||
$user = User::find($id);
|
||||
|
||||
return new InvoiceCollection(
|
||||
$this->stripe->getUserInvoices($user)
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SettingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 \App\Setting $setting
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Setting $setting)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Setting $setting
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Setting $setting)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Setting $setting
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Setting $setting)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Setting $setting
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Setting $setting)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,14 @@ class PaymentMethodsController extends Controller
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function payment_methods()
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if (! $user->hasPaymentMethod()) {
|
||||
return abort(204, 'User don\'t have any payment methods');
|
||||
}
|
||||
|
||||
$slug_payment_methods = 'payment-methods-user-' . $user->id;
|
||||
$slug_default_payment_method = 'default-payment-methods-user-' . $user->id;
|
||||
|
||||
|
||||
@@ -43,11 +43,17 @@ class SubscriptionController extends Controller
|
||||
/**
|
||||
* Get user subscription detail
|
||||
*
|
||||
* @return UserSubscription
|
||||
* @return array
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
$slug_user_subscription = 'subscription-user-' . Auth::id();
|
||||
$user = Auth::user();
|
||||
|
||||
if (! $user->subscription('main')) {
|
||||
return abort(204, 'User don\'t have any subscription');
|
||||
}
|
||||
|
||||
$slug_user_subscription = 'subscription-user-' . $user->id;
|
||||
|
||||
if (Cache::has($slug_user_subscription)) {
|
||||
return Cache::get($slug_user_subscription);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Laravel\Cashier\Http\Controllers\WebhookController as CashierController;
|
||||
|
||||
class WebhookController extends CashierController
|
||||
{
|
||||
/**
|
||||
* Handle a cancelled customer from a Stripe subscription.
|
||||
*
|
||||
* @param array $payload
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function handleCustomerSubscriptionDeleted($payload) {
|
||||
|
||||
$user = User::where('stripe_id', $payload['data']['object']['customer'])->firstOrFail();
|
||||
|
||||
// TODO: set default capacity
|
||||
$user->settings->update(['storage_capacity' => 1]);
|
||||
|
||||
return $this->successMethod();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user