Files
timebank-cc-public/app/Http/Controllers/BankController.php
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

65 lines
1.4 KiB
PHP

<?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');
}
}