Laravel: How to fix not detecting "username" input

I’m new to laravel and my code is working before but I changed "name" to "username" then if I click submit it says it doesn’t have a default value. class UserSignup extends Controller { public function register(Request $request) { $validatedData = $request->validate([ ‘username’ => [‘required’, ‘string’,’max:255′, Rule::unique(‘users’)], ’email’ => [‘required’, ’email’, ‘max:255’, Rule::unique(‘users’)], ‘password’ =>… Read More Laravel: How to fix not detecting "username" input

Will my website fetch API without CORS error when it is hosted on my web server?

I am fetching an API via JavaScript on my localhost. This leads to me having the CORS error: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Will this still occur when my site is hosted on a my web server, or is it just an issue when I’m hosting via localhost? >Solution : If… Read More Will my website fetch API without CORS error when it is hosted on my web server?

Export Postgresql Table to excel with header in Python

My code works but it doesn’t bring the header with the names, it only brings the numbers 0 1 … 10 , what can I do ? Utils_db.py def consulta_sql(sql): try: connection = psycopg2.connect(user="postgres", password="postgres", host="localhost", port="5432", database="tb_cliente") cursor = connection.cursor() except (Exception, psycopg2.Error) as error: try: cursor.execute(sql) connection.commit() except (Exception, psycopg2.Error) as error: finally:… Read More Export Postgresql Table to excel with header in Python

Flask render template doesn't render my html page keep getting "internal server error"

Running flask 2.1 w/ python 3.10 trying to create a small app here’s my main.py file contents and directory setup from waitress import serve app = Flask(__name__, template_folder=’/templates’) @app.route("/") def startService(): return "Simple Web app" @app.route("/home") def ohok(): return render_template(‘home.html’) if __name__ == "__main__": serve(app, host="127.0.0.1", port=8080) I have my home.html file correctly formatted placed… Read More Flask render template doesn't render my html page keep getting "internal server error"

how to take a value from nested object in headers

headers: { host: ‘localhost:3000’, connection: ‘keep-alive’, ‘cache-control’: ‘max-age=0’, ‘sec-ch-ua’: ‘" Not A;Brand";v="99", "Chromium";v="101", "Google Chrome";v="101"’, ‘sec-ch-ua-mobile’: ‘?0’, ‘sec-ch-ua-platform’: ‘"macOS"’, ‘upgrade-insecure-requests’: ‘1’, ‘user-agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36’, Code: const user: User = req[‘user’]; return { userAgent: { agent: req.headers.connection.reduce((el) => Object.fromEntries( Object.entries(el).map(([k, v]) => [k, Object.values(v)[0]]), ),… Read More how to take a value from nested object in headers

how to access docker service in localhost

I creates a simple service with docker image. how I want to access it in localhost of my system. docker service create –name my-app –replicas 3 -p 9090:8000 my-app-image docker service ls ID NAME MODE REPLICAS IMAGE PORTS ojvi1m6f8b41 my-app replicated 3/3 my-app-image:latest *:9090->8000/tcp docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 92b7d0ee0732… Read More how to access docker service in localhost

I am trying to fetch information from phpmyadmin database, but in browser it's showing cannot get/employee and in command prompt there is no error

const { json } = require(‘express/lib/response’); const mysql=require (‘mysql’); const express=require(‘express’); var app=express(); const bodyparser=require(‘body-parser’); app.use(bodyparser.json()); var mysqlConnection=mysql.createConnection({ host:’localhost’, user: ‘root’, password:”, database: ’employee_db’ }); mysqlConnection.connect((err)=>{ if(!err) { console.log("DB connection is successfull"); } else{ console.log("DB connection failed "+JSON.stringify(err,undefined,2)); } }); app.listen(8000,()=>console.log(‘Express server is running on port number: 8000’)); app.get(‘/employess’,(res,req)=>{ mysqlConnection.query(‘SELECT * FROM EMPLOYEE’,(err,rows,fields)=>{ if(!err) {… Read More I am trying to fetch information from phpmyadmin database, but in browser it's showing cannot get/employee and in command prompt there is no error