Skip to main content

Laravel - for a start

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.
  1. 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.
  2. 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.
  3. 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. 
  4. 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.
  5. 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.
  6. 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.

Why Laragon?
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)
npm –v
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)
cd hr
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)

CONTROLLER
To make Controller – its the logic/process. In cmd
php artisan make:controller PagesController

ROUTING
to Pages –> Home, About, Contact

DATABASE
Have your database ready
In .env  - edit database configuration settings.
database-env
PHP ARTISAN MIGRATE to dump the users login content
Migration HRdb
php artisan make:migration create_employees_table
create-db-error
MAKE MODEL
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 data
php artisan make:seeder JobTableSeeder
php artisan db:seed –-class=JobTableSeeder


FORMS


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.

Tarikh: 27 Januari 2018 (9am - 5pm) (DIBATALKAN kerana kurang penyertaan)
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.
.
YURAN
**RM??/day/person
Laptop & line Internet sendiri. Tiada makanan disediakan. Sijil tertakluk kepada permintaan.

Course Outline

Day 1
Laravel Project Structure
Login Module Example
+ Routing
+ Controller
+ Interface
+ Database 
+ Migration
+ Model
+ Example: Employee Search & Pagination
----

Kaedah Install Laragon (developing)


Comments

Popular posts from this blog

Several English proverbs and the Malay pair

Or you could download here for the Malay proverbs app – https://play.google.com/store/apps/details?id=net.kerul.peribahasa English proverbs and the Malay pair Corpus Reference: Amir Muslim, 2009. Peribahasa dan ungkapan Inggeris-Melayu. DBP, Kuala Lumpur http://books.google.com.my/books/about/Peribahasa_dan_ungkapan_Inggeris_Melayu.html?id=bgwwQwAACAAJ CTRL+F to search Proverbs in English Definition in English Similar Malay Proverbs Definition in Malay 1 Where there is a country, there are people. A country must have people. Ada air adalah ikan. Ada negeri adalah rakyatnya. 2 Dry bread at home is better than roast meat home's the best hujan emas di negeri orang,hujan batu di negeri sendiri Betapa baik pun tempat orang, baik lagi tempat sendiri. 3 There's no accounting for tastes We can't assume that every people have a same feel Kepala sama hitam hati lain-lain. Dalam kehidupan ini, setiap insan berbeza cara, kesukaan, perangai, tabia...

searchdelete.php (list records of table to delete)

< form name = 'search' method = 'get' action = '' > Insert the firstname < input type = 'text' name = 'txtname' > < input type = 'submit' value = 'search name' > </ form > < ?php //database connect $db = mysqli_connect ( "localhost" , "root" , "" , "mycompanyhr" ); //checking database connection if ( $db == false ) { echo "Connect failed: " . mysqli_connect_error ( $db ); exit (); } else { echo "Connection successful" ; } $n = $_GET [ 'txtname' ]; $sql = "select EMPNO, FIRSTNAME, LASTNAME, WORKDEPT, PHONENO from employee where FIRSTNAME like '%$n%' " ; $rs = mysqli_query ( $db , $sql ); if ( $rs == false ){ echo ( "Query cannot be executed!<br>" ); echo ( "SQL Error : " . mysqli_error ( $db )); } else { echo "<table border=1>...

Pemasangan Joomla! 1.7 pada pelayan web komputer anda

Latihan ini akan memasang sistem pengurusan kandungan laman web ke dalam pelayan web yang anda telah pasang sebelum ini . LANGKAH 1: Aktifkan Pelayan Web dan Pangkalan Data Aktifkan XAMPP Control Panel, melalui “ Start->All Programs->ApacheFriends->XAMPP Control Panel ”. Rajah 2.1 Pastikan pelayan web Apache dan pelayan pangkalan data MySQL diaktifkan dengan klik butang START. -> Rajah 2.2

Applications of Web 2.0

Web 2.0 describes the changing trends in the use of World Wide Web technology and web design that aim to enhance creativity , secure information sharing, collaboration and functionality of the web. Web 2.0 concepts have led to the development and evolution of web-based communities and hosted services , such as social-networking sites , video sharing sites , wikis , blogs . Find a website or web application that conform to the criteria of Web 2.0. Put the name of the application and the URL in the comment below. Please provide your full name and matrix number. Make sure the application you choose is not already chosen by your friend in the previous comment.

Installing Google AdMob into Android Apps

Previously I wrote on why ads are needed to help maintaining an app. Read the article here http://blog.kerul.net/2011/05/generating-revenue-from-free-mobile.html . ---This is quite an old article. You may find the latest supporting AdMob 6.x in here http://blog.kerul.net/2012/08/example-how-to-install-google-admob-6x.html --- This is quite a long tutorial, there are 3 major steps involved. The experiment is done using Windows 7, Eclipse Helios and AdMob SDK 4.1.0 (which currently is the latest-during time of writing). STEP 1: Get the ads from AdMob.com To display the AdMob ads in your Android mobile apps, you need to register first at the admob.com . After completing the registration, login and Add Site/App. Refer to Figure 1. Figure 1 Choose the desired platform and fill in the details (as in Figure 2). Just put http:// in the Android Package URL if your app is not published in the market yet. And click Continue. Figure 2 Download the AdMob Android SDK, and save the zip fil...