Path : /var/www/html/usd_loan_system/app/Http/Controllers/ |
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
Current File : /var/www/html/usd_loan_system/app/Http/Controllers/SavingFeeController.php |
<?php namespace App\Http\Controllers; use App\Models\SavingFee; use App\Models\SavingProduct; use Cartalyst\Sentinel\Laravel\Facades\Sentinel; use Illuminate\Http\Request; use Laracasts\Flash\Flash; class SavingFeeController extends Controller { public function __construct() { $this->middleware(['sentinel', 'branch']); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data = SavingFee::orderBy('id','desc')->get(); return view('savings_fee.data', compact('data')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $interest_posting = array(); $interest_posting[1] = translate('every_1_month'); $interest_posting[2] = translate('every_2_month'); $interest_posting[3] = translate('every_3_month'); $interest_posting[4] = translate('every_3_month'); $interest_posting[5] = translate('every_4_month'); $interest_posting[6] = translate('every_6_month'); $interest_posting[7] = translate('every_12_month'); $interest_posting[8] = translate('one_time_fee'); $interest_adding = array(); $interest_adding[1] = translate('1st_month'); $interest_adding[2] = translate('2nd_month'); $interest_adding[3] = translate('3rd_month'); $interest_adding[4] = translate('4th_month'); $interest_adding[5] = translate('5th_month'); $interest_adding[6] = translate('6th_month'); $interest_adding[7] = translate('7th_month'); $interest_adding[8] = translate('8th_month'); $interest_adding[9] = translate('9th_month'); $interest_adding[10] = translate('10th_month'); $interest_adding[11] = translate('11th_month'); $interest_adding[12] = translate('12th_month'); $interest_adding[13] = translate('13th_month'); $interest_adding[14] = translate('14th_month'); $interest_adding[15] = translate('15th_month'); $interest_adding[16] = translate('16th_month'); $interest_adding[17] = translate('17th_month'); $interest_adding[18] = translate('18th_month'); $interest_adding[19] = translate('19th_month'); $interest_adding[20] = translate('20th_month'); $interest_adding[21] = translate('21th_month'); $interest_adding[22] = translate('22th_month'); $interest_adding[23] = translate('23th_month'); $interest_adding[24] = translate('24th_month'); $interest_adding[25] = translate('25th_month'); $interest_adding[26] = translate('26th_month'); $interest_adding[27] = translate('27th_month'); $interest_adding[28] = translate('28th_month'); $interest_adding[29] = translate('29th_month'); $interest_adding[30] = translate('30th_month'); $interest_adding[31] = translate('31st_month'); $interest_adding[0] = translate('end_month'); $savings_products = SavingProduct::all(); return view('savings_fee.create', compact('savings_products','interest_posting','interest_adding')); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $savings_fee = new SavingFee(); $savings_fee->user_id = Sentinel::getUser()->id; $savings_fee->name = $request->name; $savings_fee->amount = $request->amount; $savings_fee->fees_posting = $request->fees_posting; $savings_fee->fees_adding = $request->fees_adding; if (!empty($request->savings_products)) { $savings_fee->savings_products = serialize($request->savings_products); } else { $savings_fee->savings_products = serialize(array()); } $savings_fee->save(); Flash::success(translate('successfully_saved')); return redirect('saving/savings_fee/data'); } public function show($savings_fee) { return view('savings_fee.show', compact('savings_fee')); } public function edit($savings_fee) { $interest_posting = array(); $interest_posting[1] = translate('every_1_month'); $interest_posting[2] = translate('every_2_month'); $interest_posting[3] = translate('every_3_month'); $interest_posting[4] = translate('every_3_month'); $interest_posting[5] = translate('every_4_month'); $interest_posting[6] = translate('every_6_month'); $interest_posting[7] = translate('every_12_month'); $interest_posting[8] = translate('one_time_fee'); $interest_adding = array(); $interest_adding[1] = translate('1st_month'); $interest_adding[2] = translate('2nd_month'); $interest_adding[3] = translate('3rd_month'); $interest_adding[4] = translate('4th_month'); $interest_adding[5] = translate('5th_month'); $interest_adding[6] = translate('6th_month'); $interest_adding[7] = translate('7th_month'); $interest_adding[8] = translate('8th_month'); $interest_adding[9] = translate('9th_month'); $interest_adding[10] = translate('10th_month'); $interest_adding[11] = translate('11th_month'); $interest_adding[12] = translate('12th_month'); $interest_adding[13] = translate('13th_month'); $interest_adding[14] = translate('14th_month'); $interest_adding[15] = translate('15th_month'); $interest_adding[16] = translate('16th_month'); $interest_adding[17] = translate('17th_month'); $interest_adding[18] = translate('18th_month'); $interest_adding[19] = translate('19th_month'); $interest_adding[20] = translate('20th_month'); $interest_adding[21] = translate('21th_month'); $interest_adding[22] = translate('22th_month'); $interest_adding[23] = translate('23th_month'); $interest_adding[24] = translate('24th_month'); $interest_adding[25] = translate('25th_month'); $interest_adding[26] = translate('26th_month'); $interest_adding[27] = translate('27th_month'); $interest_adding[28] = translate('28th_month'); $interest_adding[29] = translate('29th_month'); $interest_adding[30] = translate('30th_month'); $interest_adding[31] = translate('31st_month'); $interest_adding[0] = translate('end_month'); $savings_products = SavingProduct::all(); return view('savings_fee.edit', compact('savings_fee', 'savings_products','interest_posting','interest_adding')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $savings_fee = SavingFee::find($id); $savings_fee->name = $request->name; $savings_fee->amount = $request->amount; $savings_fee->fees_posting = $request->fees_posting; $savings_fee->fees_adding = $request->fees_adding; if (!empty($request->savings_products)) { $savings_fee->savings_products = serialize($request->savings_products); } else { $savings_fee->savings_products = serialize(array()); } $savings_fee->save(); Flash::success(translate('successfully_saved')); return redirect('saving/savings_fee/data'); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function delete($id) { SavingFee::destroy($id); Flash::success(translate('successfully_deleted')); return redirect('saving/savings_fee/data'); } }