added view expense by user

This commit is contained in:
Jagad R R
2024-12-23 10:42:27 +07:00
parent 73d779ba85
commit 83307c47e8
9 changed files with 912 additions and 40 deletions
@@ -12,6 +12,11 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Models\Role;
use App\Helpers\NextcloudHelper;
use App\Models\FormUpCountry;
use App\Models\FormEntertaimentPresentation;
use App\Models\FormVehicleRunningCost;
use App\Models\FormOthers;
use App\Models\FormMeetingSeminar;
class AdminsController extends Controller
{
@@ -121,6 +126,33 @@ class AdminsController extends Controller
return redirect()->route('admin.admins.index');
}
public function expense($user_id)
{
$formUpCountry = FormUpCountry::where('user_id', $user_id)->get();
$formEntertaimentPresentation = FormEntertaimentPresentation::where('user_id', $user_id)->get();
$formVehicleRunningCost = FormVehicleRunningCost::where('user_id', $user_id)->get();
$formOthers = FormOthers::where('user_id', $user_id)->get();
$formMeetingSeminar = FormMeetingSeminar::where('user_id', $user_id)->get();
// Combine all forms into a single array with keys for each form type
$forms = [
'form_up_country' => $formUpCountry,
'form_entertainment_presentation' => $formEntertaimentPresentation,
'form_vehicle_running_cost' => $formVehicleRunningCost,
'form_others' => $formOthers,
'form_meeting_seminar' => $formMeetingSeminar,
];
// Pass the forms and page information to the view
return view('backend.pages.admins.expense', [
'pageInfo' => [
'title' => 'Form Management',
],
'forms' => $forms,
]);
}
public function destroy(int $id): RedirectResponse
{
$this->checkAuthorization(auth()->user(), ['admin.delete']);