# เริ่มต้นใช้งาน Kotchasan Framework ## การสร้างโปรเจ็คใหม่ ### 1. สร้างโปรเจ็ค ```bash # สร้างโปรเจ็คใหม่ composer create-project kotchasan/framework my-app # เข้าไปในโฟลเดอร์โปรเจ็ค cd my-app ``` ### 2. ตั้งค่า Environment ```bash # คัดลอกไฟล์ environment cp .env.example .env # สร้าง application key php artisan key:generate ``` ### 3. ตั้งค่าฐานข้อมูล ```bash # รัน migration php artisan migrate # Seed ข้อมูลเริ่มต้น php artisan db:seed ``` ## โครงสร้างโปรเจ็ค ``` my-app/ ├── app/ │ ├── Controllers/ # Controllers │ ├── Models/ # Models │ ├── Middleware/ # Middleware │ └── Services/ # Business Logic ├── config/ # Configuration files ├── database/ │ ├── migrations/ # Database migrations │ └── seeders/ # Database seeders ├── public/ # Web root ├── resources/ │ ├── views/ # Blade templates │ └── assets/ # CSS, JS, Images ├── routes/ # Route definitions ├── storage/ # Logs, cache, sessions └── tests/ # Test files ``` ## การสร้าง Controller ### 1. สร้าง Controller ใหม่ ```bash php artisan make:controller HomeController ``` ### 2. เขียน Controller ```php 'หน้าแรก', 'message' => 'ยินดีต้อนรับสู่ Kotchasan Framework' ]; return $this->view('home', $data); } public function about() { return $this->view('about', [ 'title' => 'เกี่ยวกับเรา' ]); } } ``` ## การสร้าง Model ### 1. สร้าง Model ใหม่ ```bash php artisan make:model User ``` ### 2. เขียน Model ```php 'datetime', 'password' => 'hashed', ]; // Relationships public function posts() { return $this->hasMany(Post::class); } } ``` ## การสร้าง View ### 1. สร้างไฟล์ View ```html
= $message ?>
เริ่มต้นสร้างแอปพลิเคชันของคุณได้ทันที