Slides at fstm.kuis.edu.my/blog/laravel
TMMT6053 Advance Web Development - download proforma
Advantages of PHP Framework
There have been multiple advantages of PHP framework, while developing a website with a PHP framework. Utilizing the PHP framework can encourage website developers to show their best efforts.
- PHP framework inbuilt with robust functions: This framework is built with an excellent set of functions; you can abridge tough tasks and get quick results from PHP coding. PHP framework is freeware with various functions; utilizing these functions you can simplify the code in PHP.
- Database is a vital point: Database is the crucial factor for each project. It is the central point, where the entire data of the project are saved and called for, when required. MySQL is utilized for the database requirements for PHP.
- Use wire-frame before coding: It is always beneficial to use wire frame before you start coding in PHP. The practice of using wire-frame, boost your web development projects effectively. Make sure the wire-frame club and all its elements are integrated perfectly.
- MVC – The Model-View-Controller architectural pattern helps you tier your code for easier maintenance. By keeping the data-manipulating logic separate from the bits that handle the display, you make it much easier to change either the template or the underlying code without touching the other.
- Bundled classes – A framework includes classes and helper functions for common tasks, such as database access, pagination, and form handling. Not to mention smaller things, like truncating text to a specific word/character count.
- Rapid development – Frameworks help you create a small to medium-sized application much quicker than if you wrote everything from scratch. If you’re in a hurry, using a framework will help you finish things before you reach that looming deadline.
MVC in Laravel
LARAGON - compiled tools
(Laragon official download/docs site)
What is Laragon?
Laragon is a portable, isolated, fast & powerful universal development environment for PHP, Node.js, Python, Java, Go, Ruby. It is fast, lightweight, easy-to-use and easy-to-extend.
Laragon is great for building and managing modern web applications. It is focused on performance - designed around stability, simplicity, flexibility and freedom.
Laragon improves web development. Developers all over the world are using Laragon to make apps quickly and easily. It is used by thousands of developers with loves. You can check out the Testimonials to see how users think of Laragon and it’s features page for more details.
INSTALLING TOOLS - manual
NodeJS = https://nodejs.org
GIT - https://git-scm.com/
Composer https://getcomposer.org/download/ PHP package manager
Text Editor/ PHP storm
CHECK YOUR TOOLS’ VERSION
In your command prompt (cmd) – run as administrator
composer –v (open source package manager) to run LARAVEL
git –v (versioning control)
php –v (>PHP v5.6)
Do make sure all tools are installed and ready.
DOWNLOAD LARAVEL module to composer
composer global require "laravel/installer"
Expect a long download project package for the first time.
Laravel Project Folder
laravel new hr (download the Laravel project template)
php artisan serve (to ON the project server)
(Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for use while developing your application)
GO to your browser and test http://127.0.0.1:8000/
LARAVEL DOCUMENTATIONS https://laravel.com/docs
Concept of MVC – model view controller
In web environment ----> Routing –> Controller –> View(Presentation) –> Model(DB)
To make Controller – its the logic/process. In cmd
php artisan make:controller PagesController
to Pages –> Home, About, Contact
Have your database ready
In .env - edit database configuration settings.
PHP ARTISAN MIGRATE to dump the users login content
Migration HRdbphp artisan make:migration create_employees_table
Best practice to have the same name as the table name. Table name plural, model name singular.
php artisan make:model Employee
php artisan make:model Department
php artisan make:model Job
SEEDER - to populate predefined dataphp artisan make:seeder JobTableSeeder
php artisan db:seed –-class=JobTableSeeder
Validation – custom REQUEST
C:\hr>php artisan make:request Employee\AddRequest
MANY TO MANY with bridge-table
php artisan make:migration create_employee_project_table
Cuma nak kongsi apa yang kami tahu. Supaya mudah nak kick off projek guna Laravel PHP framework. Belum terrorists lagi. Tapi katanya kalau kita kongsi, yang sikit akan jadi banyak. Pasal ilmu bukan fizikal sifatnya. Lagi banyak dikongsi lagi besar dia tumbuh. InsyaAllah
Kursus khidmat komuniti FSTM Laravel. Jangka satu hari sahaja. Bersama trainer Khirulnizam Abd Rahman.
Tempat : Makmal Komputer 5, Bangunan Teknologi Maklumat KUIS ( maps http://bit.ly/mapfstm )
Prasyarat: tahu HTML (Bootstrap) & PHP.
Perisian (sila install sendiri sebelum datang kursus): LARAGON, dicadangkan kod editor PHPStorm atau Eclipse for PHP.
Laptop & line Internet sendiri. Tiada makanan disediakan. Sijil tertakluk kepada permintaan.
Laravel Project Structure
Login Module Example
+ Example: Employee Search & Pagination
Kaedah Install Laragon (developing)