Basic Laravel Training (for CV)

From Ta Wiki
Revision as of 16:29, 7 March 2019 by Tata (talk | contribs)
Jump to navigation Jump to search

Reference

  • Laravel Documentation
https://laravel.com/docs/5.8

Installation

Requirements

  • PHP >= 7.1.3
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension
  • BCMath PHP Extension

Steps

  1. Install LAMP Stack (ie. XAMPP)
  2. Install Composer
    https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
    หมายเหตุ: เวลาเรียกใช้งาน composer อาจจะต้องใช้ ./composer.phar แทนที่ composer ถ้าทำการ Install composer เป็น local
  3. Create new Laravel Project
    composer create-project --prefer-dist laravel/laravel PROJECT_NAME 
  4. Run Local Development Server
    php artisan serve # for running on localhost:8000
    or
    php artisan serve --port=8888 # for running on localhost:8888

Basic Tutorial

Important directory / file

  • app: Where the models are
    • Http
      • Controllers
      • Middleware
  • config
  • database
  • public: Where the public files (ie. css, js)
  • resources
    • views
  • routes
    • api.php
    • web.php
  • vendor: Where the additional libraries store
  • .env: all environment variables (ie. DB username/password)