/**
  * Show edit page
  *
  * @Get("table/{table_name}/edit/{id}", as="table.edit")
  */
 public function edit($table, $needle)
 {
     $columns = TableRow::where('table_name', $table)->where('editable', 1)->get();
     $cols = DB::table($table)->where($this->getNeedle($table), $needle)->first();
     $cols = Utils::object_to_array($cols);
     return view('tables.edit', compact('table', 'needle', 'columns', 'cols'));
 }
Beispiel #2
0
 static function object_to_array($obj)
 {
     if (is_object($obj)) {
         $obj = (array) $obj;
     }
     if (is_array($obj)) {
         $new = array();
         foreach ($obj as $key => $val) {
             $new[$key] = Utils::object_to_array($val);
         }
     } else {
         $new = $obj;
     }
     return $new;
 }