LARAVEL TRAINING (BEGINNER - INTERMEDIATE)
Kementerian Kesihatan Malaysia


Tag : Laravel, MySQL, jQuery, Twitter Bootstrap, Coaching, Javascript
Tarikh Kursus :
Sesi 1 : 16 - 19 November 2021
Sesi 2 : 22 November 2021
Lokasi : Favourite Trainer Sdn Bhd, Putrajaya
Pengenalan :
Kursus ini berkonsepkan "From Zero to Hero". Peserta seharusnya telah mempunyai asas PHP yang kuat terutamanaya konsep Object Oriented. Semua peserta dianggap belum pernah berpengalaman membuat pengaturcaraan Laravel Framework. Semuanya akan bermula dari scratch.
Perisian yang akan digunakan didalam kelas ini adalah seperti berikut :-
- Laravel Framework 8
- Laragon Full versi 4.0
- PHP 7.4
- MySQL 5.7
- jQuery 3
- Twitter Bootstrap 4
- Visual Studio Code
- SQL Yog
- Composer
- Cmder
Dicadangkan PC yang akan digunakan ialah menggunakan Window 10 dengan RAM 8 Gb, dan kapasiti Storage yang Free sebanyak min 2 Gb
Syllabus
![]() |
Introduction Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller architectural pattern. Application frameworks have grown in popularity over the past five years. There has been a tremendous shift from handwriting all code to leveraging these powerful frameworks with prebuilt components and features. Laravel joined the framework scene when there were already many players. However, the developers of Laravel used this timing to their advantage, instead of creating a framework that avoided all of the problems and mistakes previous full-stack frameworks had made and building on top of the excellent Symphony components in order to create a robust, component-based framework. What you will learn: This course is designed for students who already attend the PHP training. Anybody without the prerequisite may follow the class but need to expect not to fully grab the concept present in the class.
This class will covers the following core topics:
Course Duration : 5 days |
Module 1: Setting Up a Laravel Development Environment
Module 2: Routing and Controllers
Module 3: Blade Templating
|
Module 4: Databases and Eloquent
Module 5: Collecting and Handling User Data
Module 6. Artisan and Tinker
Module 7. User Authentication and Authorization
|
Module 8: Requests, Responses, and Middleware
Module 9: Storage and Retrieval
Module 10: Mail and Notifications
|
Training Materials
1. Laravel Book
2. PHP Tutorial (git Lab)
3. Laravel Tot (git Lab)
4. Larapro Project (git Lab)
Trainer Profile
![]() |
Nama : Azman bin Zakaria
|
|
Azman merupakan senior programmer yang passionate dalam bidang pengaturcaraan komputer dari awal mulai beliau bekerja pada tahun 2000 sehingga hari ini. Beliau mempunyai pengalaman bekerja yang luas di agensi kerajaan, swasta dan sebagai freelancer.
|
|
Notes
installation:
- Laragon (PHP 7.4, Apache 2.4, MySQL 5.7, Cmder, Heidi SQL, Composer, Auto Virtual Host)
- Visual Studio Code (VSC)
- extension: PHP, Prettier, Blade, Ayu Template, PHP HTML Formatter
PHP Version
--------------------
2000 - PHP v1
2021 - PHP v8
PHP Revision
----------------------
- First php program : Hello World
Laravel Installation
--------------------------
composer
- dependency manager
- php library installer
>composer create-project --prefer-dist laravel/laravel laravel_tot
-error memory limit
>php -d memory_limit=-1 c:\laragon\bin\composer\composer.phar create-project --prefer-dist laravel/laravel laravel_tot
>composer self-update
- update version of composer program
MVC = Model, View, Controller

revision:
- install VSC
- Laragon
- PHP 7.4
- Apache 2.4
- MySQL 5.7
- cmder
- composer
- Heidi SQL
- auto virtual host
1. basic PHP
- declare var $nama
- loop
- while(), foreach(), for()
- function tambah($no1, $no2, $no=0)
- OOP
- class dan object
- inheritance (extends)
2. Laravel
installation
- composer
>composer create-project --prefer-dist laravel/laravel[:version] <nama projek>
- MVC + Route
- routing
Route::get('/pattern', function() {...} )
rerturn view('nama', compact('...'));
- controller
- class
- class User extends Controller
- namespace
- controller use model. Pengguna::all()
- Model
- 1 model represent 1 table
- cth: class Pengguna extends Model
- view
- print data
- .blade.php
- {{ ... }} - print / echo
- layout
- @extends('layout.app')
- @section('body') ..... @endsection
- @yield('body')
Blade dan Twitter Bootstrap v5
- blade = templating engine
- https://getbootstrap.com/
- Bootstrap = CSS framework
- alternatives: Foundation / Bulma / Material / Tailwind
Laravel suggestion: dlm tiap2 table
- created_at datetime
- updated_at datetime
Laravel prefer "convention over configuration"
- PHP Artisan
- terminal / console
- generate controller / model / middleware ....
- tinker
- Session
- global variable
- flash session: temp session, exist 1 lifecycle
- set message
- Middleware
- route -> middleware -> controller
- log
- authentication dan authorization
- Authentication
- login
- Authorization
- access level
- File Storage
- upload
- rename file...
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's
content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<div class="card card-primary card-outline">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's
content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div><!-- /.card -->
</div>
<!-- /.col-md-6 -->
<div class="col-lg-6">
<div class="card">
<div class="card-header">
<h5 class="m-0">Featured</h5>
</div>
<div class="card-body">
<h6 class="card-title">Special title treatment</h6>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Featured</h5>
</div>
<div class="card-body">
<h6 class="card-title">Special title treatment</h6>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<!-- /.col-md-6 -->
</div>
<!-- /.row -->
Revision day 2:
- CRUD
- create form
- insert (Request $req)
- save()
- edit, update, re-use form
- save()
- delete
- delete()
Model / Eloquent Functions
- all()
- find()
- save()
- delete()
PHP Artisan
- php artisan list
- php artisan tinker
- php artisan make:controller <nama contoller>
- php artisan make:model <nama contoller>
- php artisan make:middleware <nama contoller>
- ... up , ... down
Middleware
- run between Route dgn controller
- Route::middleware(['nama middleware')->group(function() ....);
Authentication
- \Auth::attempt($credentials)
- once berjaya, refer \Auth::user()->col_name, \Auth::logout()
Class yg pre-import oleh laravel
- rujuk /config/app.php, see section aliases
Front-end tech
- view (V)
- Js
- Vuejs (Community, Evan Yu)
- Angular (google)
- ReactJs (Fb)
- JSON
Back-end tech
- laravel
- java, springboot, yii
- MVC
SPA - Single Page Application
Debug Bar
- google "laravel debug bar"
- barryvdh (github)
APP_DEBUG=true (show debug bar) / false = turn off
pertanyaan pn su:
- kegunaan {var}
Route::get('/user/{name}', function($name) {
echo $name;
});
{name} = variable / data
http://../user/azman
http://../user/abu
Bootstrap Template
-wrapboostrap
-evanto market
-creative tim
- ..
adminlte - free
- starter.html (copy semua src code)
sakila db
- google "download sakila mysql"
Tinker
jika ubah class selepas enter tinker, exit dulu, then enter semula
\App\Models\Film::where('title', 'Alone')->get();
Model Convention
1. table plural, model singular
2. primary key is ID
3. every table ada created_at, updated_at
2 jenis Teknik Query
1. Eloquent / ORM / Model
- Film::all();
2. Query Builder
- \DB::table('film')->select('title, description')->get();
revision day 3:
- install 3rd party library
- debug bar
- composer require <nama library> --dev
- register composer.json
- Query analysis
- debug error
Bootstrap Template
- wrapbootstrap
- evanto market
- adminlte
- starter.html
- creative tim
crate new proj
- >composer ....
- layout/mater.blade.php
- dashboard
- pagination
- sakila DB
- film (1000)
- tinker
- model :Film
- Film::all(), Film::limit(10)->get(), Film::where(...)->get()
- Query Builder (5% - 10%)
- DB::table('film')->select('film_id, title')->get()
- DB::select("select * from film");
Login
1. Model User
- point ke table users (by default)
2. Auth::attempt()
php artisan cache:clear
php artisan
http://laravel_tot.test/password
- manually generate pssword (hashed)
- \Hash::make('1234');
Middleware
- AuditTrail
table: audit_trail
- id (pk) int auto_increment
- user_id var(25)
- created_at datetime
- updated_at datetime
- url var(100)
- data
- prev_url var(100)
- ip
Revision day #4:
- create larapro.test
- adminlte
- layout
- starter.html
- @yield('body')
- login / authentication
- middleware (login)
- middleware (AuditTrail)
- table: audit_trail
- sakila DB
- Film
- pagination
- paginate(20) alt. (all() / get())
- $films->links()
- search
- combination: title dan descr
Day 5
Model Relationship
- one to one
- one to many
- many to many (middle table)
- Query builder
- CRUD
- validation (Validation::make())
- $req->validate()
- API
- JSON
One to One
table phone:
id (pk)
user_id (fk)
table user:
id (pk)
User -> phone
- hasOne(Phone)
- 1 user ada 1 phone
- PK dan FK
(inverse)
Phone -> User
- belongsOne(User)
One to Many
table customer:
customer_id (pk)
- hasMany(Rental)
table rental:
rental_id (pk)
customer_id (fk)
- belongsTo(Customer)
Many to Many
table: film
- belongsToMany(FilmActor)
table: film_actor
- belongsToMany(Film)
gitlab.com/azman1204
Photo Gallery




Borang Penilaian Keberkesanan Latihan
Training evaluation ยท LARAVEL TRAINING (BEGINNER - INTERMEDIATE)
Log in with the account you registered for this training to fill in the survey.
Log in to fill in the surveyAttendance
Students (8)
| # | Name |
|---|---|
| 1. | PUTERI SYASYA ATIQAH BINTI AZMI |
| 2. | Mohd Sukri bin Muhammad Bakri |
| 3. | Azizi bin Harun |
| 4. | Banu A/P P Ochatewan |
| 5. | Fasihah binti Mansor |
| 6. | Norazian Binti Zainal Abidin |
| 7. | Mohd Shuhaimi Othman |
| 8. | Sulaiha Binti Suhod |
