Example #1
0
 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'));
 }
Example #3
0
 /**
  * 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');
 }
Example #4
0
 public function getTableNameAttribute()
 {
     return Table::where('id', '=', $this->table_id)->first()->table_name;
 }
Example #5
0
 /**
  * Make the table occupied
  *
  * @param $tableId
  * @return mixed
  */
 private function makeTableAvailable($tableId)
 {
     $table = Table::where('id', $tableId)->update(['status' => Table::AVAILABLE]);
     return $table;
 }
Example #6
0
 /**
  * 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();
 }