public function edit(Request $request, $id) { $item = Items::find($id); if ($item) { $profits = ProfitPercentage::all('id', 'profit_name'); $itemtype = ItemType::all(); return view('item.edit', compact('item', 'profits', 'itemtype')); } else { return redirect()->action('ItemsController@index')->with('error', 'El producto solicitado no existe'); } }
public function destroy($id, Request $request) { //ELIMINACIÓN DE PORCENTAJE $profit = ProfitPercentage::find($id); if ($profit->delete()) { //SE REGISTRA LA ACTIVIDAD EN LA BITACORA $this->binnacle("ELIMINÓ % DE GANANCIA", $request); } Session::flash('message', 'La ganancia se eliminó correctamente'); return Redirect::to('/profit'); }
/** * Run the database seeds. * * @return void */ public function run() { Prof::create(['profit_name' => '10% Medicinas', 'profit_description' => 'Procentaje aplicable a todos los medicamentos genéricos', 'profit_percentage' => '0.10', 'profit_type' => 'compras']); Prof::create(['profit_name' => '5% Soluciones', 'profit_description' => 'Procentaje aplicable a todas las soluciones', 'profit_percentage' => '0.05', 'profit_type' => 'compras']); Prof::create(['profit_name' => '4% Equipo médico', 'profit_description' => 'Procentaje aplicable a todo el equipo médico', 'profit_percentage' => '0.04', 'profit_type' => 'compras']); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $users = User::lists('name', 'id'); $percentages = ProfitPercentage::type('comisiones')->get()->lists('profit_name', 'id'); return view('commission.create', compact('users', 'percentages')); }