Similar Posts

  • Performance across different technologies for building REST APIs

    When comparing performance across different technologies for building REST APIs (Python, Java with Servlets, Java Spring Boot, and PHP with PDO), there are several factors to consider, such as scalability, speed, ease of development, and suitability for your specific use case. However, performance can vary significantly depending on your specific application and infrastructure. 1. Python…

  • การเพิ่ม, ลบ, และแก้ไขคอลัมน์ใน Laravel ด้วย Migration

    ก่อนอื่น ถ้าต้องการแก้ไขตารางที่มีอยู่แล้ว ต้องใช้คำสั่ง make:migration โดยเพิ่ม –table=table_name เพื่อระบุว่าจะแก้ไขตารางไหน 1️⃣ การเพิ่มคอลัมน์ 🔹 ตัวอย่าง: เพิ่มคอลัมน์ phone และ address ในตาราง users ไฟล์ Migration ที่สร้างขึ้นจะอยู่ใน database/migrations/ และมีโค้ดเริ่มต้น ✏️ แก้ไขไฟล์ Migration: 📌 คำอธิบาย: ✅ รัน Migration: 2️⃣ การลบคอลัมน์ 🔹 ตัวอย่าง: ลบคอลัมน์ phone ออกจากตาราง users ✏️ แก้ไขไฟล์ Migration: ✅ รัน Migration: 3️⃣ การแก้ไขคอลัมน์ 📌 การแก้ไขคอลัมน์ใน Laravel ต้องใช้ doctrine/dbal package💡 ติดตั้ง package ก่อน…

  • การเชื่อมต่อฐานข้อมูลใน Laravel

    Laravel รองรับการเชื่อมต่อฐานข้อมูลผ่าน Eloquent ORM และ Query Builder ซึ่งสามารถทำงานร่วมกับฐานข้อมูลหลายประเภท เช่น MySQL, PostgreSQL, SQLite และ SQL Server 1️⃣ การตั้งค่าการเชื่อมต่อฐานข้อมูล ไฟล์การตั้งค่าฐานข้อมูลใน Laravel อยู่ที่ 📌 1.1 ตั้งค่าในไฟล์ .env เปิดไฟล์ .env และตั้งค่าการเชื่อมต่อฐานข้อมูล เช่น MySQL 🔹 เปลี่ยนค่า DB_DATABASE, DB_USERNAME, และ DB_PASSWORD ตามค่าจริงของคุณ 🔹 ถ้าใช้ SQLite, ให้แก้เป็น (หรือใช้ database/database.sqlite ในโปรเจกต์) 📌 1.2 ตั้งค่าใน config/database.php แม้ว่าจะไม่ค่อยต้องแก้ไฟล์นี้ แต่ถ้าต้องการกำหนดค่าเพิ่มเติม สามารถแก้ได้ที่ ⚠️ หมายเหตุ: 2️⃣ ทดสอบการเชื่อมต่อฐานข้อมูล หลังจากตั้งค่าแล้ว…

  • PHP Artsan CLI Command For Laravel

    🔹 Laravel 11 Extensions & Packages Laravel has many useful extensions (packages) to enhance its functionality. Here are some commonly used ones: 1️⃣ Authentication & Security 🔹 Laravel Sanctum (API Authentication) 📌 Used for: Token-based API authentication. 🔹 Laravel Breeze (Simple Authentication) 📌 Used for: Lightweight authentication (Login, Register, Forgot Password). 🔹 Laravel Jetstream (Advanced…

  • How to Setup Webserver On Ubuntu 22.04 with NGINX PHP MYSQL

    Setting up a web server on Ubuntu 22.04 using Nginx, PHP 8.2, and MySQL Server requires several steps. Follow this guide to install and configure everything correctly. Step 1: Update Your System Before installing any software, update your system packages: Step 2: Install Nginx Nginx is a lightweight and high-performance web server. Step 3: Install…

Leave a Reply

Your email address will not be published. Required fields are marked *