Skip to content
weworknetwork

weworknetwork

  • About
  • About
  • Clients
  • Clients
  • Contact
weworknetwork
weworknetwork
  • Uncategorized

    📌 Model ใน Laravel คืออะไร?

    Byitdhivii@gmail.com March 4, 2025

    Model ใน Laravel เป็นคลาสที่ใช้เชื่อมต่อและจัดการข้อมูลกับฐานข้อมูล โดยใช้ Eloquent ORM (Object-Relational Mapping) เพื่อให้สามารถเรียกใช้งานข้อมูลได้สะดวกขึ้น โดย Model จะเชื่อมโยงกับตารางในฐานข้อมูล โดยอัตโนมัติ 📌 โครงสร้าง MVC ใน Laravel 📌 การสร้าง Model ใน Laravel สามารถสร้าง Model ได้โดยใช้คำสั่ง Artisan CLI คำสั่งนี้จะสร้างไฟล์ Model ที่ app/Models/Product.php 📌 ตัวอย่าง Model (app/Models/Product.php) 📌 การใช้งาน Model กับฐานข้อมูล 1️⃣ ดึงข้อมูลจากฐานข้อมูล 📌 ดึงข้อมูลทั้งหมด (SELECT * FROM products;) 📌 ดึงข้อมูลแค่บางรายการ (SELECT * FROM products…

    Read More 📌 Model ใน Laravel คืออะไร?Continue

  • Uncategorized

    Laravel Artisan commands

    Byitdhivii@gmail.com March 2, 2025

    Here are the Laravel Artisan commands to create a migration, model, controller, view, and component: 1. Create a Migration 2. Create a Model 🔹 With Migration and Factory: 🔹 With Controller: 3. Create a Controller 🔹 Create a Resource Controller: 4. Create a Blade View Blade views are not created with Artisan. Instead, manually create…

    Read More Laravel Artisan commandsContinue

  • Uncategorized

    generate migrations from an existing database in Laravel

    Byitdhivii@gmail.com March 2, 2025March 2, 2025

    To create a Laravel migration file from an existing MySQL database, follow these steps: 1. Install laravel-migrations-generator package Since Laravel does not generate migrations from an existing database by default, use a third-party package: 2. Generate Migrations Run the following command to generate migration files from your MySQL database: This will create migration files for…

    Read More generate migrations from an existing database in LaravelContinue

  • Uncategorized

    Generate a Model from an Existing Migration in Laravel

    Byitdhivii@gmail.com March 2, 2025

    To auto-create a model from a migration file in Laravel, follow these steps: 1. Generate a Model from an Existing Migration Run the following command: For example, if your table is inventories, run: 2. Generate a Model with a Migration and Factory (if needed) If you haven’t created a migration yet and want to generate…

    Read More Generate a Model from an Existing Migration in LaravelContinue

  • Uncategorized

    ทำความเข้าใจส่วนประกอบของเส้นทาง (Route) ใน Laravel กัน

    Byitdhivii@gmail.com February 24, 2025

    มาทำความเข้าใจส่วนประกอบของเส้นทาง (Route) นี้ทีละส่วนกันครับ: ตัวอย่าง Route::get(‘asset/getall’, [AssetController::class, ‘getall’])->name(‘asset.getall’); 1. Route::get() 2. ‘asset/getall’ 3. [AssetController::class, ‘getall’] 4. ->name(‘asset.getall’) สรุปการทำงานทั้งหมด:เมื่อมี request เข้ามาที่ URL /asset/getall ด้วย method GET→ Laravel จะเรียกใช้ method getall() ใน AssetController→ method นี้จะทำการดึงข้อมูลและส่งกลับ response ไปยังผู้ใช้ ตัวอย่างการใช้งานจริง:สมมติว่าเราต้องการดึงข้อมูล Asset ทั้งหมดจาก API ประโยชน์ของการตั้งชื่อ Route: ควรใช้เมื่อไหร่?

    Read More ทำความเข้าใจส่วนประกอบของเส้นทาง (Route) ใน Laravel กันContinue

  • Uncategorized

    insert existing users with plain-text passwords into Laravel’s users table

    Byitdhivii@gmail.com February 20, 2025February 22, 2025

    To insert existing users with plain-text passwords into Laravel’s users table (used by Laravel Breeze authentication), follow these steps: ✅ Step 1: Hash Passwords Before Inserting Since Laravel requires bcrypt hashed passwords, you need to hash them before inserting into the users table. You can do this in a Laravel command, seeder, or migration script….

    Read More insert existing users with plain-text passwords into Laravel’s users tableContinue

Page navigation

Previous PagePrevious 1 2 3 4 5 6 Next PageNext

© 2025 weworknetwork - WordPress Theme by Kadence WP

  • About
  • About
  • Clients
  • Clients
  • Contact