public function asset_type_data() { \DB::statement(\DB::raw('set @rownum=0')); $asset_types = AssetType::select([\DB::raw('@rownum := @rownum + 1 AS rownum'), 'id', 'code', 'name']); return Datatables::of($asset_types)->addColumn('action', function ($asset_type) { return ' <a href="./asset_type/edit/' . $asset_type->id . '" class="btn btn-xs btn-warning"><i class="glyphicon glyphicon-edit"></i> Edit</a> '; })->make(true); }
public function edit($id) { $asset_types = AssetType::select(\DB::raw("CONCAT(asset_types.code,'-',asset_types.name) AS full_name, id"))->lists('full_name', 'id'); $asset_category = AssetCategory::find($id); return view('asset_categories.edit', compact('asset_category', 'asset_types')); }