/** * 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(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { if (Auth::user()->role === 'superadmin') { $input = $request->all(); PaymentType::create($input); return redirect('payment_type'); } else { return redirect('auth/login'); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(PaymentTypeRequest $request) { PaymentType::create($request->all()); return redirect(route('paymenttypes.index'))->with('message', 'Forma de pago creada 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]); }