/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $payment_type = PaymentType::find($id); if (isset($payment_type)) { $payment_type->delete(); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $store = Store::find($id); $days = Day::all(); $brands = Brand::lists('brand_name', 'id')->all(); $payment_types = PaymentType::lists('type_name', 'id')->all(); return view('admin.stores.edit', compact('store', 'days', 'brands', 'payment_types')); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('payment_types')->delete(); $payment_types = array(['name' => 'Cash'], ['name' => 'Cheque'], ['name' => 'Credit Card'], ['name' => 'E-Transfer'], ['name' => 'Paypal'], ['name' => 'Other']); foreach ($payment_types as $pt) { PaymentType::create($pt); } Model::reguard(); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { if (Auth::user()->role === 'superadmin') { $input = $request->all(); $data = PaymentType::findOrFail($id); $data->update($input); return redirect('payment_type'); } else { return redirect('auth/login'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $paymenttype = PaymentType::findOrFail($id); PaymentType::destroy($id); return redirect(route('paymenttypes.index'))->with('message', 'Cliente ' . $paymenttype->name . ' eliminado corectamente'); }
/** * Run the database seeds. * * @return void */ public function run() { PaymentType::create(['payment_type' => 'Invoice Payment', 'status_id' => 1]); PaymentType::create(['payment_type' => 'Others', 'status_id' => 1]); }