validate($request, [ 'name' => 'required', 'title' => 'string|nullable', 'description' => 'string|nullable', 'license' => 'string|nullable', 'upstream' => 'string|nullable', 'columns' => 'required', 'data' => 'string|nullable', ]); // Check if table name is unique for user $name = $request->get('name'); if ($u->tables()->where('name', $name)->exists()) { return back()->withErrors([ 'title' => "A table called \"$name\" already exists in your account.", ]); } return "Ok."; } }