move into sonardesk
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Licensing\Http\Controllers\Customer;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Modules\Licensing\Models\License;
|
||||
|
||||
final class CustomerLicensingController extends Controller
|
||||
{
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$email = mb_strtolower(trim((string) $request->user()->email));
|
||||
|
||||
$licenses = License::query()
|
||||
->with('product')
|
||||
->whereRaw('LOWER(customer_email) = ?', [$email])
|
||||
->latest()
|
||||
->paginate(15);
|
||||
|
||||
return view('licensing::customer.index', compact('licenses'));
|
||||
}
|
||||
|
||||
public function show(Request $request, License $license): View
|
||||
{
|
||||
// Return 404, not 403, to avoid disclosing whether a licence exists.
|
||||
abort_unless(
|
||||
hash_equals(
|
||||
mb_strtolower(trim((string) $license->customer_email)),
|
||||
mb_strtolower(trim((string) $request->user()->email))
|
||||
),
|
||||
404
|
||||
);
|
||||
|
||||
$license->load(['product', 'activations']);
|
||||
|
||||
return view('licensing::customer.show', compact('license'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user