/** * Run the database seeds. * * @return void */ public function run() { //for($i = 0, i < 100, i++){} $type_id = \App\Type::where('type', '=', 'Neighborhood casual')->pluck('id'); $fc_perc = \App\Type::where('id', '=', '3')->pluck('fc_perc_t'); $bc_perc = \App\Type::where('id', '=', '3')->pluck('bc_perc_t'); $lc_perc = \App\Type::where('id', '=', '3')->pluck('lc_perc_t'); $qfac_perc = \App\Type::where('id', '=', '3')->pluck('qfac_perc_t'); DB::table('proformas')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'proj_name' => "John Harvards", 'food_sales' => 30000, 'bev_sales' => 15000, 'tl_sales' => 'food_sales' + 'bev_sales', 'fc_doll' => 'food_sales' * 'fc_perc', 'bc_doll' => 'bev_sales' * 'bc_perc', 'lc_doll' => 'tl_sales' * 'lc_perc', 'qfac_doll' => 'tl_sales' * 'qfac_perc', 'tot_vcost' => 'fc_doll' + 'bc_doll' + 'lc_doll', 'tot_vcost_perc' => 'tot_vcost' / 1, 'rent' => 0, 'other_fx_cost' => 0, 'g_a' => 'tl_sales' * 0.02, 'tot_fx_cost' => 'rent' + 'other_fx_cost' + 'g_a', 'pretax_prof' => 'tl_sales' - ('tot_vcost' + 'tot_fx_cost'), 'tax_rate' => 0.33, 'tot_prof' => 'pretax_prof' - 'pretax_prof' * 'tax_rate', 'bep_doll' => 'tot_fx_cost' / 1, 'avg_check' => 35, 'bep_cov' => 'bep_doll' / 1]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $search = \Request::get('search'); $getCategory = \Request::get('category'); if (is_null($search) || is_null($getCategory) || $search == "" || $getCategory == "") { $types = Type::orderBy('id', 'DESC')->paginate(10); } else { $types = Type::where($getCategory, 'like', '%' . $search . '%')->orderBy($getCategory)->paginate(1000); } $category = array('' => 'kategori', 'name' => 'Nama'); return view('type.index', compact('types', 'category')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $search = \Request::get('search'); $getCategory = \Request::get('category'); if (is_null($search) || is_null($getCategory) || $search == "" || $getCategory == "") { $items = Item::orderBy('id', 'DESC')->paginate(10); } else { if ($getCategory == "type_id") { $types = Type::where('name', 'like', '%' . $search . '%')->orderBy('name')->first(); $items = Item::where($getCategory, 'like', '%' . $types->id . '%')->orderBy($getCategory, 'DESC')->paginate(1000); } else { $items = Item::where($getCategory, 'like', '%' . $search . '%')->orderBy($getCategory, 'DESC')->paginate(1000); } } $category = array('' => 'kategori', 'name' => 'Nama Barang', 'type_id' => 'Jenis Barang'); return view('item.index', compact('items', 'category')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $typeId = Request::get('id'); Type::where('id', $typeId)->delete(); return redirect("types"); }
public function getTypes(Request $request) { $query = $request->all()['q']; $types = Type::where('name', 'LIKE', '%' . $query . '%')->get(); $types->transform(function ($item, $key) { return ['id' => $item->id, 'name' => $item->name]; }); return $types; }
/** * Show the form for creating a new Cruiseline. * * @return View */ public function edit($id) { $product = Product::find($id); $types = Type::where('status', '=', '1')->orderBy('name', 'ASC')->lists('name', 'id'); $categories = Category::where('status', '=', '1')->orderBy('name', 'ASC')->lists('name', 'id'); $brochures = Brochure::where('status', '=', '1')->whereHas('label', function ($q) { $q->where('name', '=', 'Size Charts'); })->orderBy('name', 'ASC')->lists('name', 'id'); $colours = Colour::where('status', '=', '1')->lists('name', 'id'); return view('products.edit', compact('product', 'types', 'categories', 'brochures', 'colours')); }