0% found this document useful (0 votes)
35 views2 pages

Composer Require Laravelcollective/html

This document discusses two topics: 1. Installing the laravelcollective/html package to use Blade HTML and forms. This involves running a Composer command and adding the package to the app.php configuration file. 2. Preparing a database table called "tb_barang" using migrations. This involves creating a database, updating the .env file, generating a migration file, adding code to the migration file, running all migrations with an Artisan command, and generating a model.

Uploaded by

terjamin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Composer Require Laravelcollective/html

This document discusses two topics: 1. Installing the laravelcollective/html package to use Blade HTML and forms. This involves running a Composer command and adding the package to the app.php configuration file. 2. Preparing a database table called "tb_barang" using migrations. This involves creating a database, updating the .env file, generating a migration file, adding code to the migration file, running all migrations with an Artisan command, and generating a model.

Uploaded by

terjamin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

I.

Instal laravelcollective/html
Biar bisa menggunakan blade html dan form.
1. Ketik di command prompt (direktori berada di folder framework laravel) :
composer require laravelcollective/html
2. Ketik di config/app.php :
- Tambahkan di Providers :
Collective\Html\HtmlServiceProvider::class,
- Tambahkan di Aliases :
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
- Tes dengan cara di resources/view/welcome.blade.php ketik: {!!Form::open()!!}
jika berhasil akan tampil tulisan laravel
II. Persiapan Database
table "tb_barang" (migration)
kd_brg
char(4) pk
nm_brg
varchar(50)
stok
int
harga_beli
int
tgl_beli
date
gambar
text
1. Buat database di mysql db_laravel
2. Ubah di file .env menjadi seperti berikut

3. Buat file migration, php artisan make:migration tb_barang_create

File migrasi berada di direktori database\migrations

4.

Ketik kode berikut di database\migrations\2016_07_17_135622_tb_barang_create

5.

Jalankan migrasi (semua file) dg cara php artisan migrate di command prompt. Atau untuk satu file

6.

php artisan migrate --path=app/database/migrations/<nama_file>


Buat model, php artisan make:model tb_barang di composer
File model berada di app/file_model
Ketik kode berikut pada file model tb_barang

You might also like