public function update(StoreTableRequest $request, $tableId) { $input = $request->all(); $input['slug'] = str_replace(' ', '_', strtolower($input['name'])); $table = Table::where('id', $tableId)->update($input); return $this->createResponse($table); }
/** * Show Setting Page * * @Get("table/{table_name}/settings", as="setting.show") */ public function settings($table) { $type_options = ['text' => 'Text', 'password' => 'Password', 'number' => 'Number', 'radio' => 'Radio', 'checkbox' => 'Checkbox', 'select' => 'Select', 'range' => 'Range', 'content_editor' => 'Content Editor', 'belongs_to' => 'Belongs To', 'has_one' => 'Has One']; if (!Schema::hasTable($table)) { Flash::error('Specified table not found.'); return view('tables.settings'); } $columns_count = count(Schema::getColumnListing($table)); if ($columns_count != TableRow::where('table_name', $table)->count()) { Table::where('table_name', $table)->first()->initialRows(); } $columns = TableRow::where('table_name', $table)->get(); return view('tables.settings', compact('columns', 'table', 'type_options')); }
/** * Update curd * * @Put("crud/{id}", as="crud.update") */ public function update($id) { $v = Validator::make(Input::all(), Table::$edit_rules); if ($v->fails()) { $msg = Utils::buildMessages($v->errors()->all()); Flash::error($msg); return redirect()->route('crud.edit', $id)->withErrors($v)->withInput(); } if (0 != Table::where('table_name', Input::get('table_name'))->where('id', '!=', $id)->count()) { Flash::error('Table name already exist.'); return redirect()->route('crud.edit', $id)->withInput(); } Table::find($id)->update(Input::all()); Flash::success('CRUD updated successfully.'); return redirect()->route('index'); }
public function getTableNameAttribute() { return Table::where('id', '=', $this->table_id)->first()->table_name; }
/** * Make the table occupied * * @param $tableId * @return mixed */ private function makeTableAvailable($tableId) { $table = Table::where('id', $tableId)->update(['status' => Table::AVAILABLE]); return $table; }
/** * Get table's needle * */ protected function getNeedle($table) { return Table::where('table_name', $table)->select('needle')->first()->needle; }
public function deleteProject(Application $application) { Table::where(['applications' => ['$in' => [$application->_id]]])->delete(); $application->delete(); return $this->response->json(); }