Initial commit
This commit is contained in:
64
app/Http/Controllers/BankController.php
Normal file
64
app/Http/Controllers/BankController.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
|
||||
class BankController extends Controller
|
||||
{
|
||||
public function show($id)
|
||||
{
|
||||
return app(ProfileController::class)->showBank($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$bank = getActiveProfile();
|
||||
|
||||
// Verify this is a bank profile
|
||||
if (!($bank instanceof \App\Models\Bank)) {
|
||||
abort(403, 'Not a valid bank profile');
|
||||
}
|
||||
|
||||
// Verify the user can manage this bank
|
||||
$user = Auth::guard('web')->user();
|
||||
if (!$user->banksManaged->contains($bank->id)) {
|
||||
abort(403, 'You do not have permission to edit this bank');
|
||||
}
|
||||
|
||||
return view('profile-bank.edit', [
|
||||
'bank' => $bank
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function settings()
|
||||
{
|
||||
return view('profile-bank.settings');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user