⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.63
Server IP:
217.76.53.76
Server:
Linux vmi1397931.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
hrm.com.ng
/
app
/
Http
/
Controllers
/
View File Name :
OtherPaymentController.php
can('Create Other Payment')) { $validator = \Validator::make( $request->all(), [ 'employee_id' => 'required', 'title' => 'required', 'amount' => 'required', ] ); if($validator->fails()) { $messages = $validator->getMessageBag(); return redirect()->back()->with('error', $messages->first()); } $otherpayment = new OtherPayment(); $otherpayment->employee_id = $request->employee_id; $otherpayment->title = $request->title; $otherpayment->type = $request->type; $otherpayment->amount = $request->amount; $otherpayment->created_by = \Auth::user()->creatorId(); $otherpayment->save(); if( $otherpayment->type == 'percentage' ) { $employee = Employee::find($otherpayment->employee_id); $loansal = $otherpayment->amount * $employee->salary / 100; } return redirect()->back()->with('success', __('OtherPayment successfully created.')); } else { return redirect()->back()->with('error', __('Permission denied.')); } } public function show(OtherPayment $otherpayment) { return redirect()->route('commision.index'); } public function edit($otherpayment) { $otherpayment = OtherPayment::find($otherpayment); if(\Auth::user()->can('Edit Other Payment')) { if($otherpayment->created_by == \Auth::user()->creatorId()) { $otherpaytypes=OtherPayment::$otherPaymenttype; return view('otherpayment.edit', compact('otherpayment','otherpaytypes')); } else { return response()->json(['error' => __('Permission denied.')], 401); } } else { return response()->json(['error' => __('Permission denied.')], 401); } } public function update(Request $request, OtherPayment $otherpayment) { if(\Auth::user()->can('Edit Other Payment')) { if($otherpayment->created_by == \Auth::user()->creatorId()) { $validator = \Validator::make( $request->all(), [ 'title' => 'required', 'amount' => 'required', ] ); if($validator->fails()) { $messages = $validator->getMessageBag(); return redirect()->back()->with('error', $messages->first()); } $otherpayment->title = $request->title; $otherpayment->type = $request->type; $otherpayment->amount = $request->amount; $otherpayment->save(); if( $otherpayment->type == 'percentage' ) { $employee = Employee::find($otherpayment->employee_id); $loansal = $otherpayment->amount * $employee->salary / 100; } return redirect()->back()->with('success', __('OtherPayment successfully updated.')); } else { return redirect()->back()->with('error', __('Permission denied.')); } } else { return redirect()->back()->with('error', __('Permission denied.')); } } public function destroy(OtherPayment $otherpayment) { if(\Auth::user()->can('Delete Other Payment')) { if($otherpayment->created_by == \Auth::user()->creatorId()) { $otherpayment->delete(); return redirect()->back()->with('success', __('OtherPayment successfully deleted.')); } else { return redirect()->back()->with('error', __('Permission denied.')); } } else { return redirect()->back()->with('error', __('Permission denied.')); } } }