Dokumen tersebut memberikan ringkasan tentang Laravel, sebuah framework PHP untuk membangun aplikasi berbasis web. Ia menjelaskan apa itu framework dan manfaatnya, serta langkah-langkah dasar untuk menginstal dan menggunakan Laravel seperti persiapan yang dibutuhkan, proses instalasi, dan konsep dasar MVC.
PROGRESS DEV - Basic Laravel 5.3 Part #2UKM PROGRESS
1. Blade templating merupakan template engine khusus yang digunakan oleh Laravel untuk membangun tampilan web. File blade disimpan di folder resources/views dengan akhiran .blade.php.
2. Fungsi blade seperti @yield, @section, @extends digunakan untuk mendefinisikan layout dan konten web. Contohnya dengan membuat master page dan content page.
3. Routing digunakan untuk mengatur URL dan menghubungkan antara view dan controller. Contoh routing dasar menggunakan
How to connect laravel 5.1 blade view to database using mvc conceptfadhilmeist
Dokumen ini memberikan instruksi langkah demi langkah untuk menghubungkan view Blade Laravel ke database MySQL menggunakan konsep MVC. Langkah-langkahnya meliputi membuat proyek dan database, mengatur koneksi database, membuat controller dan model, menambahkan data ke database, membuat layout dan view untuk menampilkan daftar buku, serta mengujicobanya.
Artikel ini akan menjabarkan tentang bagaimana membuat modul crud sederhana dengan framework Laravel 5 (pada saat tulisan ini dibuat, yang digunakan versi 5.6). Yaitu bagaimana membuat modul untuk menginput informasi, menyimpan, mengedit, dan juga menghapusnya. Untuk keperluan ini, Laravel yang merupakan framework PHP MVC populer memiliki fitur bawaan yang mempermudah kita dalam membuat modul CRUD.
Dokumen tersebut memberikan panduan lengkap tentang belajar dasar Laravel untuk pemula, mulai dari pengertian Laravel, cara instalasi di Windows dan Linux, persiapan pembuatan CRUD (create, read, update, delete) di Laravel seperti pengaturan database dan integrasi Bootstrap, sampai contoh kode untuk membuat CRUD lengkap di Laravel.
Dokumen tersebut menjelaskan proses instalasi dan konfigurasi web server Apache, bahasa skrip PHP, dan database MySQL untuk membangun sistem website dinamis. Langkah-langkahnya meliputi instalasi paket Apache, PHP, dan MySQL; pengujian konfigurasi masing-masing; serta penggunaan phpMyAdmin untuk manajemen database MySQL.
Class merupakan blueprint untuk menciptakan objek dengan atribut dan perilaku yang sama. Dokumen ini membahas pengertian class dalam Java beserta contoh kode class sederhana dan perbandingan beberapa jenis web server populer seperti Apache, Nginx, IIS dan LiteSpeed.
Program Pelatihan Computer Technical Support, Networking, Technical Support Smartphone, Kesehatan Berbasis Islamiyah, Alamiyah & Ilmiyah
Perum Gaperi BDB 2, Jl. Gunung Salak V Blok FE No. 5, RT 02/17 Kelurahan Sukahati Cibinong Bogor
SMS : 087862088129, 085211098788
YM : rasyadhermawan
Pin : 7556788F
Tulisan ini membahas penggunaan framework Zend untuk membangun aplikasi PHP. Secara singkat, tulisan ini menjelaskan tentang struktur folder dan file-file dasar yang dibutuhkan untuk memulai pengembangan dengan Zend framework, termasuk cara membuat controller, view, dan form inputan sederhana.
Dokumen tersebut membahas tentang Java Server Pages (JSP) sebagai teknologi untuk menghasilkan konten dinamis dan statis pada web. JSP memungkinkan pengembang untuk menggabungkan kode Java dan template HTML untuk menghasilkan halaman web dinamis. Dokumen ini menjelaskan syntax dasar JSP seperti scriptlets, ekspresi, dan deklarasi untuk menambahkan logika Java ke dalam halaman web.
Pengenalan membuat aplikasi berbasis web seri pertama
contoh code di
https://drive.google.com/file/d/1JkmIp3jUU-w6w5dmf9itfWxIWREjpOP_/view?usp=sharing
Mambo adalah CMS berbasis PHP dan MySQL yang kemudian berkembang menjadi Joomla setelah terjadi perselisihan antara pengembang dan pendiri Mambo. Joomla memiliki fitur yang sama dengan Mambo seperti modul, komponen, dan template. PHP adalah bahasa skrip open source yang digunakan untuk mengembangkan Mambo dan Joomla.
Dokumen tersebut membahas tentang pengenalan PHP, MySQL, dan Apache sebagai bahasa pemrograman dan perangkat lunak open source yang sering digunakan bersama untuk membangun sistem berbasis web. Dokumen ini juga menjelaskan cara instalasi dan konfigurasi PHP, MySQL, dan Apache serta penggunaan sintaks dasar PHP seperti variabel dan konstanta.
This document provides an introduction to Git and common Git workflows. It discusses what Git is, how it stores data as snapshots rather than file changes, and its advantages as a distributed version control system where the full code history is stored locally. It then demonstrates basic Git commands like init, add, commit, status, branch, merge, tag and working with remotes. Key points covered include initializing and cloning repositories, tracking changes, committing work, branching and merging, and sharing code via remote repositories.
Appminds is stealth mode global provider of Mobile and Responsive App Development, Integration and Technology Services Company that can build complex enterprise grade solutions.
This document discusses object-oriented programming concepts like inheritance, polymorphism, overloading, and overriding. It provides examples of inheritance hierarchies for different types of birds. Inheritance allows subclasses to inherit attributes and methods from parent classes. Polymorphism means an object can have different implementations of the same method depending on its type. Overloading and overriding relate to creating multiple methods with the same name that differ in parameters or implementation.
Mari Memahami PSR (PHP Standards Recommendation)Mizan Riqzia
Dokumen tersebut membahas tentang PHP Standards Recommendation (PSR) yang dikembangkan oleh PHP Framework Interop Group (PHP-FIG). PSR merupakan standar koding untuk PHP yang bertujuan agar berbagai framework PHP dapat saling bekerja sama dengan lebih baik."
This document discusses best practices for designing RESTful web APIs. It covers topics such as using HTTP verbs for actions, providing sensible resource names, using response codes to indicate status, offering both JSON and XML formats, creating fine-grained resources, considering connectivity between resources, handling errors properly, using versioning, supporting pagination and partial responses, including timestamps in requests and responses, and authenticating via methods such as OAuth2. The document provides examples from existing APIs at companies like Facebook, Twilio, and LinkedIn.
This document provides an overview of object-oriented programming (OOP) concepts in PHP including classes, objects, encapsulation, polymorphism, inheritance, magic methods, interfaces, abstract classes, and type hinting. Key points covered include defining classes with properties and methods, instantiating objects from classes, visibility of properties and methods, extending and overriding parent classes, implementing interfaces, and using polymorphism through interfaces to allow different classes to be used interchangeably.
Mengenal dasar OOP di PHP untuk Web Programmer. Meetup Web Programming untuk pemula - http://www.meetup.com/Garut-Software-Development-Meetup/
Program Pelatihan Computer Technical Support, Networking, Technical Support Smartphone, Kesehatan Berbasis Islamiyah, Alamiyah & Ilmiyah
Perum Gaperi BDB 2, Jl. Gunung Salak V Blok FE No. 5, RT 02/17 Kelurahan Sukahati Cibinong Bogor
SMS : 087862088129, 085211098788
YM : rasyadhermawan
Pin : 7556788F
Tulisan ini membahas penggunaan framework Zend untuk membangun aplikasi PHP. Secara singkat, tulisan ini menjelaskan tentang struktur folder dan file-file dasar yang dibutuhkan untuk memulai pengembangan dengan Zend framework, termasuk cara membuat controller, view, dan form inputan sederhana.
Dokumen tersebut membahas tentang Java Server Pages (JSP) sebagai teknologi untuk menghasilkan konten dinamis dan statis pada web. JSP memungkinkan pengembang untuk menggabungkan kode Java dan template HTML untuk menghasilkan halaman web dinamis. Dokumen ini menjelaskan syntax dasar JSP seperti scriptlets, ekspresi, dan deklarasi untuk menambahkan logika Java ke dalam halaman web.
Pengenalan membuat aplikasi berbasis web seri pertama
contoh code di
https://drive.google.com/file/d/1JkmIp3jUU-w6w5dmf9itfWxIWREjpOP_/view?usp=sharing
Mambo adalah CMS berbasis PHP dan MySQL yang kemudian berkembang menjadi Joomla setelah terjadi perselisihan antara pengembang dan pendiri Mambo. Joomla memiliki fitur yang sama dengan Mambo seperti modul, komponen, dan template. PHP adalah bahasa skrip open source yang digunakan untuk mengembangkan Mambo dan Joomla.
Dokumen tersebut membahas tentang pengenalan PHP, MySQL, dan Apache sebagai bahasa pemrograman dan perangkat lunak open source yang sering digunakan bersama untuk membangun sistem berbasis web. Dokumen ini juga menjelaskan cara instalasi dan konfigurasi PHP, MySQL, dan Apache serta penggunaan sintaks dasar PHP seperti variabel dan konstanta.
This document provides an introduction to Git and common Git workflows. It discusses what Git is, how it stores data as snapshots rather than file changes, and its advantages as a distributed version control system where the full code history is stored locally. It then demonstrates basic Git commands like init, add, commit, status, branch, merge, tag and working with remotes. Key points covered include initializing and cloning repositories, tracking changes, committing work, branching and merging, and sharing code via remote repositories.
Appminds is stealth mode global provider of Mobile and Responsive App Development, Integration and Technology Services Company that can build complex enterprise grade solutions.
This document discusses object-oriented programming concepts like inheritance, polymorphism, overloading, and overriding. It provides examples of inheritance hierarchies for different types of birds. Inheritance allows subclasses to inherit attributes and methods from parent classes. Polymorphism means an object can have different implementations of the same method depending on its type. Overloading and overriding relate to creating multiple methods with the same name that differ in parameters or implementation.
Mari Memahami PSR (PHP Standards Recommendation)Mizan Riqzia
Dokumen tersebut membahas tentang PHP Standards Recommendation (PSR) yang dikembangkan oleh PHP Framework Interop Group (PHP-FIG). PSR merupakan standar koding untuk PHP yang bertujuan agar berbagai framework PHP dapat saling bekerja sama dengan lebih baik."
This document discusses best practices for designing RESTful web APIs. It covers topics such as using HTTP verbs for actions, providing sensible resource names, using response codes to indicate status, offering both JSON and XML formats, creating fine-grained resources, considering connectivity between resources, handling errors properly, using versioning, supporting pagination and partial responses, including timestamps in requests and responses, and authenticating via methods such as OAuth2. The document provides examples from existing APIs at companies like Facebook, Twilio, and LinkedIn.
This document provides an overview of object-oriented programming (OOP) concepts in PHP including classes, objects, encapsulation, polymorphism, inheritance, magic methods, interfaces, abstract classes, and type hinting. Key points covered include defining classes with properties and methods, instantiating objects from classes, visibility of properties and methods, extending and overriding parent classes, implementing interfaces, and using polymorphism through interfaces to allow different classes to be used interchangeably.
Mengenal dasar OOP di PHP untuk Web Programmer. Meetup Web Programming untuk pemula - http://www.meetup.com/Garut-Software-Development-Meetup/
Brian Feaver gives an overview of the Laravel PHP framework. He explains that Laravel is built on Symfony components and provides services and libraries to make interacting with web requests easier. The basics covered include routing, controllers, templating with Blade, and Eloquent ORM. Cool features highlighted are Artisan, dependency injection, queues, middleware, filesystem abstraction, and built-in authentication. Facades are discussed as a way to access underlying services, though injecting services directly is preferable.
This document provides an overview of the Laravel PHP framework, including instructions for installation, directory structure, MVC concepts, and a sample "task list" application to demonstrate basic Laravel features. The summary covers creating a Laravel project, defining a database migration and Eloquent model, adding routes and views with Blade templating, performing validation and CRUD operations, and more.
Managing a YouTube channel requires branding and consistency. The presenters will discuss strategies for setting up and customizing a YouTube channel, including connecting it to a Google+ page or profile, uploading and optimizing video content, and using analytics to promote the channel and build a subscriber base. They will also provide an overview of their video production company RHED Pixel and the types of clients and content they work with.
Learn about some of the new features in Laravel 5, with a focus on the command pipeline, including a few opinions about how to use the pipeline in the best possible way to enforce a solid separation of concerns.
Vikas Chauhan presented a document outlining 5 exercises for learning Laravel: 1) Installation and configuration, 2) Writing a Hello World program, 3) Using Laravel Blade templates, 4) Implementing layouts with Blade, and 5) Different types of routes. Each exercise includes multiple tasks with instructions on creating controllers, views, and routes to demonstrate different Laravel features.
SlideShare now has a player specifically designed for infographics. Upload your infographics now and see them take off! Need advice on creating infographics? This presentation includes tips for producing stand-out infographics. Read more about the new SlideShare infographics player here: http://wp.me/p24NNG-2ay
This infographic was designed by Column Five: http://columnfivemedia.com/
No need to wonder how the best on SlideShare do it. The Masters of SlideShare provides storytelling, design, customization and promotion tips from 13 experts of the form. Learn what it takes to master this type of content marketing yourself.
This document provides tips to avoid common mistakes in PowerPoint presentation design. It identifies the top 5 mistakes as including putting too much information on slides, not using enough visuals, using poor quality or unreadable visuals, having messy slides with poor spacing and alignment, and not properly preparing and practicing the presentation. The document encourages presenters to use fewer words per slide, high quality images and charts, consistent formatting, and to spend significant time crafting an engaging narrative and rehearsing their presentation. It emphasizes that an attractive design is not as important as being an effective storyteller.
10 Ways to Win at SlideShare SEO & Presentation OptimizationOneupweb
Thank you, SlideShare, for teaching us that PowerPoint presentations don't have to be a total bore. But in order to tap SlideShare's 60 million global users, you must optimize. Here are 10 quick tips to make your next presentation highly engaging, shareable and well worth the effort.
For more content marketing tips: http://www.oneupweb.com/blog/
Framework MVC sederhana dibuat dengan PHP untuk memisahkan kode program dari antarmuka. Model bertanggung jawab atas pengelolaan data, view menampilkan antarmuka, dan controller menghubungkan model dan view. Contoh controller blog dan model blog dibuat untuk menampilkan daftar artikel blog dan form tambah artikel.
Modul praktikum Pemrograman web Backend dengan Codeigniter dan LTEIgun
Modul ini membahas tentang pembuatan aplikasi web dengan menggunakan CodeIgniter PHP framework. Terdapat penjelasan mengenai instalasi XAMPP web server, pengenalan HTML, CSS, PHP, dan MySQL serta cara membangun aplikasi web sederhana menggunakan CodeIgniter.
Dokumen tersebut membahas tentang implementasi operasi CRUD (create, read, update, delete) menggunakan framework CodeIgniter di PHP. Terdapat penjelasan mengenai pembuatan model, controller dan view untuk melakukan operasi CRUD terhadap database."
server side datatables menggunakan yajra 1 pada laravel admin lteAdi Nata
jika anda mengelola data dalam jumlah banyak seperti 10.000 record atau lebih maka meload data dengan client side bukanlah merupakan sebuah solusi yang tepat maka di perlukan solusi untuk meload data server side
Tiga kalimat ringkasan dokumen tersebut adalah:
Dokumen tersebut menjelaskan cara menginstal Nginx dengan dukungan PHP5 dan MySQL pada sistem operasi CentOS 6.5, meliputi penginstalan dan konfigurasi Nginx, PHP-FPM, dan MySQL beserta modul-modul yang dibutuhkan.
Yii2 Framework merupakan salah satu PHP Framework populer. Salah satu keunggulannya adalah mampu mempercepat waktu development, fitur-fitur yang bisa di-extend dan mendukung PHP modern. Pada slide ini kita akan belajar fundamentalnya terlebih dahulu, sebelum terjun membangun project.
Mengkonfigurasi web server menggunakan (roundcube) di debian 7Ahmad Fauzan
Dokumen tersebut merupakan laporan tugas akhir mengenai konfigurasi web server menggunakan Roundcube di Debian 7. Laporan ini menjelaskan tentang instalasi Roundcube mulai dari persiapan, penginstalan, konfigurasi database, hingga konfigurasi akses hak untuk mendapatkan tampilan webmail yang dapat digunakan untuk mengirim dan menerima email.
Membuat Sitemap untuk Website Dinamis dengan PHP.pdfomuru
Tutorial kali ini kita akan Membuat Sitemap.xml untuk website yang kita buat sendiri dengan PHP MYSQLi baik Native atau dengan framework,
Tentunya untuk keperluan SEO (search engine optimization ) sitemap sangatlah dibutuhkan , Dimana Sitemap merupakan sebuah peta navigasi situs dimana terdapat kumpulan link-link yang tersusun dalam bentuk Tree yang akan membantu Mesin pencari / search engine untuk menelusuri secara total Website Kita atau dengan kata lain
CMS adalah sistem manajemen konten yang memungkinkan pengelolaan konten secara online melalui panel. Dokumen ini menjelaskan cara membuat CMS sederhana untuk menampilkan kumpulan artikel dengan fitur registrasi pengguna, pengiriman artikel, dan panel admin. Langkah-langkahnya meliputi pembuatan database, layout, file koneksi, form registrasi, login, pengiriman artikel, dan cek hak akses pengguna dan admin.
Dokumen ini menjelaskan cara menginstal dan mengkonfigurasi Rainloop, sebuah aplikasi webmail gratis, pada Ubuntu 14.04 menggunakan Nginx sebagai web server dan MariaDB sebagai database. Langkah-langkahnya meliputi instalasi MariaDB, PHP, dan Nginx, kemudian mendeploy Rainloop dan mengkonfigurasi Nginx untuk mengarahkan lalu lintas ke Rainloop.
Belajar Framework CodeIgnitier Lengkap (bahasa Indonesia)riarel
Ringkasan dokumen tersebut adalah:
Dokumen tersebut membahas tentang belajar PHP menggunakan framework Code Igniter, meliputi pengenalan Code Igniter, instalasi, konsep MVC, dan contoh coding dasar menggunakan Code Igniter.
Belajar Framework CodeIgnitier Lengkap (bahasa Indonesia)riarel
Ad
Laravel 5 Tutorial : Membuat Blog Sederhana dengan Laravel 5.3
1. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
1 www.hc-kr.com
MEMBUAT BLOG
LARAVEL 5.3 + MYSQL
DATABASE
KHUSUS PEMULA
2. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
2 www.hc-kr.com
Halo coder, ketemu lagi dengan saya orang paling ganteng
sekecamatan. Kali ini saya akan berbagi ilmu tentang bagaimana cara
membuat blog sederhana di Laravel 5.3.
Dalam tutorial ini akan di ajarkan step by step, yang dimulai dari
penginstalan Laravel 5.3 di localhost sampai dengan Prosess CRUD
nya serta pembuatan Bootstrap templatenya. Jadi silahkan siapkan
kopi dan fokus ke leptop masing-masing ya guys.
#Step 1 Intro
pada step ini tidak terlalu penting, hanya saja untuk mengetahui
seperti apa nantinya aplikasi yang akan kita buat, langsung saja lihat
video tutorial berikut https://youtu.be/ctsr4A-5XEQ dan
http://www.hc-kr.com/2016/09/laravel-5-tutorial-crud-operations-
example.html
#Step 2 Database & Migration
Pertama, silahkan buat database yang akan kita gunakan untuk
penyimpanan data nantinya, buat database MySQL dengan nama
laravel_blog, biar serasi.
kemudian buka cmd kamu dan untuk membuat project baru di Laravel
ketikkan command berikut :
cd c:serverhtdocs
composer create-project --prefer-dist
laravel/laravel web
cd web
proses penginstalan Laravel biasanya memakan waktu beberapa
menit, jadi silahkan ngopi dulu sambil nunggu sampai selesai.
Jika sudah selesai, tinggal buka project (web) dengan text editor
kesayangan kamu guys, kalau saya menggunakan Atom Text Editor.
3. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
3 www.hc-kr.com
Ada beberapa hal yang penting kita atur sebelum melanjutkan tutorial
ini.
membuat koneksi Ke database
untuk membuat koneksi ke database, cukup dengan mengatur pada
file .ENV seperti dibawah ini.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_blog
DB_USERNAME=root
DB_PASSWORD=password_kamu
Migrasi Database
Untuk membuat migrasi di Laravel 5.3, langsung saja tuliskan
command berikut :
php artisan make:migration create_blog_table
Kalau sudah berhasil, file migrasi kamu akan berada di
databasemigrations2016_09_13_113838_crate_blog_table.php
Kita akan menambahkan function untuk membuat table dan column
secara otomatis, tuliskan code pada file migrasi kamu.
<?php
use IlluminateSupportFacadesSchema;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;
class CrateBlogTable extends Migration
{
/**
* Run the migrations.
*
4. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
4 www.hc-kr.com
* @return void
*/
public function up()
{
Schema::create('blog_post', function
(Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blog_post');
}
}
Terakhir silahkan simpan, dan mari eksekusi dengan command
php artisan migrate
Video tutorialnya dimari https://youtu.be/afmcqHTCCQk dan full
source codenya dimari http://www.hc-kr.com/2016/09/laravel-5-blog-
tutorial-database-migration.html
5. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
5 www.hc-kr.com
#Step 3 Restful Controllers & Routing
System
Selanjutnya, untuk membuat controller di laravel 5.3, tuliskan
command berikut
php artisan make:controller BlogController --
resource
File controller kamu sudah berhasil dibuat dan tersimpan di folder
appHttpControllersBlogController.php
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppHttpRequests;
class BlogController extends Controller
{
/**
* Display a listing of the resource.
*
* @return IlluminateHttpResponse
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return IlluminateHttpResponse
*/
6. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
6 www.hc-kr.com
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param IlluminateHttpRequest $request
* @return IlluminateHttpResponse
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified
resource.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function edit($id)
{
//
7. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
7 www.hc-kr.com
}
/**
* Update the specified resource in storage.
*
* @param IlluminateHttpRequest $request
* @param int $id
* @return IlluminateHttpResponse
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function destroy($id)
{
//
}
}
Membuat Routes
Untuk membuat routes di Laravel 5.3 silahkan buka folder
routesweb.php, kita akan membuat route baru dalam middleware
group.
<?php
/*
|--------------------------------------------------
------------------------
8. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
8 www.hc-kr.com
| Web Routes
|--------------------------------------------------
------------------------
|
| This file is where you may define all of the
routes that are handled
| by your application. Just tell Laravel the URIs
it should respond
| to using a Closure or controller method. Build
something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
// we will ad new route into middleware group
Route::group(['middleware' => ['web']], function()
{
Route::resource('blog','BlogController');
});
Video tutorial dimari https://youtu.be/eHNRpYB_wJk dan source
code dimari http://www.hc-kr.com/2016/09/laravel-5-blog-tutorial-
database-migration.html
#Step 4 Model Eloquent & Displaying Data from Database
Pertama, kita akan membuat Model baru dengan mengetikkan
command berikut
php artisan make:model Blog
9. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
9 www.hc-kr.com
Model yang baru kamu buat akan di simpan di AppBlog.php
<?php
namespace App;
use IlluminateDatabaseEloquentModel;
class Blog extends Model
{
protected $table ='blog_post';
}
Selanjutnya, untuk mengambil semua data dari database, kita kembali
ke controller (BlogController.php) dan tuliskan code berikut
Tambahkan namespaces di header controller kita
use AppBlog;
pada controller tambahkan function ini
public function index()
{
// we will create index function
// we need to show all data from "blog"
table
$blogs = Blog::all();
// show data to our view
return view('blog.index',['blogs' =>
$blogs]);
}
Next, untuk menampilkannya di browser, kita akan membuat view
baru yang disimpan di resourcesviews, silahkan buat folder baru
dengan nama blog dalam folder resourcesviews tersebut. Jadi kita
membuat view baru dengan nama index.blade.php dan akan
tersimpan di resourcesviewsblogindex.blade.php
10. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
10 www.hc-kr.com
<h1>My First Blog</h1>
@foreach ($blogs as $blog)
<h2>{{ $blog->title }}</h2>
<p>{{ $blog->description }}</p>
<hr>
@endforeach
Sekarang kamu bisa membuaka blog pertama kamu dengan laravel di
http://localhost:8080/blog
Video tutorialnya dimari https://youtu.be/GvLvGbkUbVs dan full
source code di mari http://www.hc-kr.com/2016/09/part4-laravel-5-
blog-tutorial-model.html
#Step 5 Insert Data, Validation, Redirect
Page and Flash Message
Selanjutnya kita akan membuat function baru di controller
(BlogController.php)
public function create()
{
// we will return to our new views
return view('blog.create');
}
/**
* Store a newly created resource in storage.
*
* @param IlluminateHttpRequest $request
* @return IlluminateHttpResponse
*/
public function store(Request $request)
{
// we will create validation function here
11. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
11 www.hc-kr.com
$this->validate($request,[
'title'=> 'required',
'description' => 'required',
]);
$blog = new Blog;
$blog->title = $request->title;
$blog->description = $request->description;
// save all data
$blog->save();
//redirect page after save data
return redirect('blog')-
>with('message','data hasbeen updated!');
}
Selanjutnya buat View baru dengan nama create.blade.php yang
disimpan di resourcesviewsblogcreate.blade.php
<!-- @if (count($errors) > 0)
<ul>
@foreach ($errors->all() as $error )
<li>{{ $error }}</li>
@endforeach
</ul>
@endif -->
<h2>Add new post</h2>
<form class="" action="/blog" method="post">
<input type="text" name="title" value=""
placeholder="this is title"><br>
{{ ($errors->has('title')) ? $errors-
>first('title') : '' }} <br>
<textarea name="description" rows="8" cols="40"
placeholder="this is description"></textarea><br>
{{ ($errors->has('description')) ? $errors-
>first('description') : '' }} <br>
12. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
12 www.hc-kr.com
<input type="hidden" name="_token" value="{{
csrf_token() }}">
<input type="submit" name="name" value="post">
</form>
Tambahkan Session di index.blade.php
{{ Session::get('message') }}
<h1>My First Blog</h1>
@foreach ($blogs as $blog)
<h2>{{ $blog->title }}</h2>
<p>{{ $blog->description }}</p>
<hr>
@endforeach
Video tutorialnya dimari https://youtu.be/0X6hkeR91ko dan source
codenya dimari http://www.hc-kr.com/2016/09/laravel-5-create-
blog-insert-validation-redirect-page.html
#Step 6 membuat Single Page and 404 Page
pada controller (BlogController.php) kita, tambahkan function
berikut
public function show($id)
{
$blog = Blog::find($id);
// return to 404 page
if(!$blog){
abort(404);
}
// display the article to single page
13. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
13 www.hc-kr.com
return view('blog.detail')-
>with('blog',$blog);
}
Dan kemudian buatlah view baru dengan nama detail.blade.php
<h1>Detail Page</h1>
<h2>{{ $blog->title }}</h2>
<p>
{{ $blog->description }}
</p>
<br>
<a href="/blog">Back to Home</a>
Kemudian edit kembali index.blade.php kita sebelumnya
{{ Session::get('message') }}
<h1>My First Blog</h1>
@foreach ($blogs as $blog)
<h2><a href="/blog/{{ $blog->id }}">{{ $blog-
>title }}</a></h2>
<p>{{ $blog->description }}</p>
<hr>
@endforeach
Video tutorialnya dimari https://youtu.be/Qr4e1okgFuc dan full
source codenya dimari http://www.hc-kr.com/2016/09/laravel-5-
create-blog-insert-validation-redirect-page.html
14. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
14 www.hc-kr.com
#Step 7 Update Database Recorded
Tambah edit dan update function di Controller kita
(BlogController.php)
edit function
public function edit($id)
{
// edit function here
$blog = Blog::find($id);
// return to 404 page
if(!$blog){
abort(404);
}
// display the article to single page
return view('blog.edit')-
>with('blog',$blog);
}
update function
public function update(Request $request, $id)
{
// we will create validation function here
$this->validate($request,[
'title'=> 'required',
'description' => 'required',
]);
$blog = Blog::find($id);
15. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
15 www.hc-kr.com
$blog->title = $request->title;
$blog->description = $request->description;
// save all data
$blog->save();
//redirect page after save data
return redirect('blog')->with('message','data
hasbeen edited!');
}
Selanjutnya buat view baru dengan nama edit.blade.php
<h2>Edit Article Post</h2>
<form class="" action="/blog/{{ $blog->id }}"
method="post">
<input type="text" name="title" value="{{ $blog-
>title }}" placeholder="this is title"><br>
{{ ($errors->has('title')) ? $errors-
>first('title') : '' }} <br>
<textarea name="description" rows="8" cols="40"
placeholder="this is description">{{ $blog-
>description }}</textarea><br>
{{ ($errors->has('description')) ? $errors-
>first('description') : '' }} <br>
<input type="hidden" name="_method" value="put">
<input type="hidden" name="_token" value="{{
csrf_token() }}">
<input type="submit" name="name" value="edit">
</form>
Edit kembali file index.blade.php kita
{{ Session::get('message') }}
<h1>My First Blog</h1>
16. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
16 www.hc-kr.com
@foreach ($blogs as $blog)
<h2><a href="/blog/{{ $blog->id }}">{{ $blog-
>title }}</a></h2>
<p>{{ $blog->description }}</p>
<a href="/blog/{{ $blog->id }}/edit">Edit this
Post</a>
<hr>
@endforeach
Video tutorialnya dimari https://youtu.be/t2z2k2EJiec dan source
codenya dimari http://www.hc-kr.com/2016/09/laravel-5-blog-
tutorial-update-database.html
#Step 8 Delete data with Eloquent Syntax
Tambahkan function destroy di controller (BlogController.php)
public function destroy($id)
{
$blog = Blog::find($id);
$blog->delete();
return redirect('blog')-
>with('message','data hasbeen deleted!');
}
Selanjutnya edit file index.blade.php yang ada di folder views
{{ Session::get('message') }}
<h1>My First Blog</h1>
@foreach ($blogs as $blog)
<h2><a href="/blog/{{ $blog->id }}">{{ $blog-
>title }}</a></h2>
{{ date('F d, Y', strtotime($blog->created_at))
}}
<p>{{ $blog->description }}</p>
17. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
17 www.hc-kr.com
<a href="/blog/{{ $blog->id }}/edit">Edit this
Post</a><br>
<form class="" action="/blog/{{ $blog->id }}"
method="post">
<input type="hidden" name="_method"
value="delete">
<input type="hidden" name="_token" value="{{
csrf_token() }}">
<input type="submit" name="name"
value="delete">
</form>
<hr>
@endforeach
Video tutorialnya dimari https://youtu.be/vgHuJFU0CyE dan Full
source codenya dimari http://www.hc-kr.com/2016/09/laravel-5-
blog-tutorial-deleting-data-eloquent.html
#Step 9 Pagination with Eloquent & Query
Builder
Pada step ini, ada dua macam method yang bisa kita gunakan untuk
membuat pagination di laravel 5.3.
Pagination dengan Query Builder
pada controller (BlogController.php)
public function index()
{
// we will create index function
// we need to show all data from "blog"
table
// $blogs = Blog::all();
// first, pagination using query builder
18. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
18 www.hc-kr.com
$blogs = DB::table('blog_post')-
>paginate(2);
// pagination using Eloquent
// $blogs = Blog::paginate(2);
// show data to our view
return view('blog.index',['blogs' =>
$blogs]);
}
Pagination dengan Eloquent
public function index()
{
// we will create index function
// we need to show all data from "blog"
table
// $blogs = Blog::all();
// first, pagination using query builder
// $blogs = DB::table('blog_post')-
>paginate(2);
// pagination using Eloquent
$blogs = Blog::paginate(2);
// show data to our view
return view('blog.index',['blogs' =>
$blogs]);
}
Kamu bisa memilih salah satu method diatas.
dan pada index.blade.php yang ada di folder views,
{{ Session::get('message') }}
<h1>My First Blog</h1>
19. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
19 www.hc-kr.com
@foreach ($blogs as $blog)
<h2><a href="/blog/{{ $blog->id }}">{{ $blog-
>title }}</a></h2>
{{ date('F d, Y', strtotime($blog->created_at))
}}
<p>{{ $blog->description }}</p>
<a href="/blog/{{ $blog->id }}/edit">Edit this
Post</a><br>
<form class="" action="/blog/{{ $blog->id }}"
method="post">
<input type="hidden" name="_method"
value="delete">
<input type="hidden" name="_token" value="{{
csrf_token() }}">
<input type="submit" name="name"
value="delete">
</form>
<hr>
@endforeach
{!! $blogs->links() !!}
Video tutorialnya dimari https://youtu.be/mwb9V4E0wm4 dan full
source codenya dimari http://www.hc-kr.com/2016/09/laravel-5-
blog-tutorial-pagination-eloquent.html
#Step 10 Menambahkan Bootstrap Theme
untuk step ini, langsung saja kamu lihat video tutorialnya dibawah ini
Video tutorialnya dimari https://youtu.be/2n3q2oof084 dan full
source codenya dimari http://www.hc-kr.com/2016/09/laravel-5-
blog-tutorial-adding-bootstrap-theme.html
20. Membuat blog sederhana dengan Laravel 5.3 dan database MySQL
20 www.hc-kr.com
Sekian tutorial sederhananya.
Informasi lebih lengkapnya tentang belajar Laravel 5.3 silahkan
langsung saja ke blog kami http://www.hc-kr.com/p/create-blog-
using-laravel-5-for.html