This document discusses creating REST APIs with Express, Node.js, and MySQL. It provides an overview of Express and its advantages. It then demonstrates how to set up a Node.js and MySQL environment, create an Express server, and implement API routes to GET, POST, DELETE, and PUT data from a MySQL database table. Code examples are provided to retrieve all todos, a single todo by ID, search todos by keyword, add a new todo, delete a todo, and update an existing todo.
Laporan ini membahas percobaan membuat aplikasi chatting menggunakan protokol TCP dengan model komunikasi client-server. Percobaan ini melibatkan pengkodean program client dan server serta pengujian komunikasi antara kedua program tersebut.
Constructor is a special member method which will be called automatically when you create an object of any class.
The main purpose of using constructor is to initialize an object.
http://www.tutorial4us.com/java/java-constructor
This document discusses JavaScript events. It defines an event as an action a script can respond to, such as clicks or keystrokes. Event handlers are functions assigned to events that run when the event occurs. Events follow a cycle of capturing, targeting, and bubbling. Common event types include mouse, keyboard, loading, selection, and other events. The document provides examples of using event handlers with buttons, images, and adding/removing event listeners.
PHP is a server-side scripting language used to create dynamic web pages. It allows embedding PHP code within HTML pages and interacting with databases. Key elements of PHP include variables, control structures, functions, and sessions. Sessions store user data on the server instead of the client to avoid cookies and allow tracking users across multiple pages.
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
Spring is a flexible Java framework that provides solutions to commonly occurring problems in Java projects. It uses an inversion of control container and aspect-oriented programming to increase modularity. Spring supports features like dependency injection, MVC web development, and integration with other technologies like JPA, Hibernate and JDBC. Some key benefits of Spring include loose coupling of components, reducing boilerplate code, and aiding testability.
The AlarmManager API allows applications to schedule code to run at some point in the future even if the application is not actively running. Alarms can be set to repeat at intervals like every 15 minutes or every hour. Alarms remain active even when the device is asleep and can optionally wake the device. The AlarmManager is accessed through the Context and allows setting one-shot or repeating alarms to launch activities, broadcasts, or services at the scheduled time.
This document discusses creating REST APIs with Express, Node.js, and MySQL. It provides an overview of Express and its advantages. It then demonstrates how to set up a Node.js and MySQL environment, create an Express server, and implement API routes to GET, POST, DELETE, and PUT data from a MySQL database table. Code examples are provided to retrieve all todos, a single todo by ID, search todos by keyword, add a new todo, delete a todo, and update an existing todo.
Laporan ini membahas percobaan membuat aplikasi chatting menggunakan protokol TCP dengan model komunikasi client-server. Percobaan ini melibatkan pengkodean program client dan server serta pengujian komunikasi antara kedua program tersebut.
Constructor is a special member method which will be called automatically when you create an object of any class.
The main purpose of using constructor is to initialize an object.
http://www.tutorial4us.com/java/java-constructor
This document discusses JavaScript events. It defines an event as an action a script can respond to, such as clicks or keystrokes. Event handlers are functions assigned to events that run when the event occurs. Events follow a cycle of capturing, targeting, and bubbling. Common event types include mouse, keyboard, loading, selection, and other events. The document provides examples of using event handlers with buttons, images, and adding/removing event listeners.
PHP is a server-side scripting language used to create dynamic web pages. It allows embedding PHP code within HTML pages and interacting with databases. Key elements of PHP include variables, control structures, functions, and sessions. Sessions store user data on the server instead of the client to avoid cookies and allow tracking users across multiple pages.
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
Spring is a flexible Java framework that provides solutions to commonly occurring problems in Java projects. It uses an inversion of control container and aspect-oriented programming to increase modularity. Spring supports features like dependency injection, MVC web development, and integration with other technologies like JPA, Hibernate and JDBC. Some key benefits of Spring include loose coupling of components, reducing boilerplate code, and aiding testability.
The AlarmManager API allows applications to schedule code to run at some point in the future even if the application is not actively running. Alarms can be set to repeat at intervals like every 15 minutes or every hour. Alarms remain active even when the device is asleep and can optionally wake the device. The AlarmManager is accessed through the Context and allows setting one-shot or repeating alarms to launch activities, broadcasts, or services at the scheduled time.
The document provides an overview of JavaScript programming. It discusses the history and components of JavaScript, including ECMAScript, the DOM, and BOM. It also covers JavaScript basics like syntax, data types, operators, and functions. Finally, it introduces object-oriented concepts in JavaScript like prototype-based programming and early vs. late binding.
This document discusses delegates, anonymous methods, lambda expressions, and events in C#. Delegates allow encapsulating references to methods and functions. Anonymous methods provide a way to pass code blocks as delegates without needing separate methods. Lambda expressions create anonymous functions using the => operator. Events enable classes to notify other classes when something of interest occurs, with publishers raising events and subscribers handling them.
Tomcat is an open-source servlet container developed by the Apache Software Foundation that implements Java Servlet and JavaServer Pages technologies. It is written in Java and can run on several operating systems. Tomcat allows developers to deploy web applications and services built using Java technologies. The document provides examples of using servlets and JSPs with Tomcat and describes how to configure and deploy web applications on Tomcat.
Virtual functions allow functions to be overridden in derived classes. The virtual keyword before a function in the base class specifies that the function can be overridden. When a virtual function is called using a base class pointer, the version from the most derived class will be executed due to late binding. This allows runtime polymorphism where the function call is resolved based on the actual object type rather than the pointer variable type.
An app widget allows users to interact with an app's key functionality directly from their home screen. This document discusses what app widgets are, how the app widget framework works, and the steps to create an app widget, including declaring an AppWidgetProvider in the manifest, creating AppWidgetProviderInfo metadata and layout XML files, writing the AppWidgetProvider class, and optionally adding an app widget configuration activity.
Redis is an open source, advanced key-value store that can be used for caching, sessions, publishing/subscribing, job queues, and more. It supports atomic operations, ordered lists, sets, hashes and sorted sets. Data can be saved to disk for persistence. Redis has client libraries for many languages like Node.js and can be accessed via a command line interface. Popular use cases include caching application data to improve performance, storing sessions to allow user authentication across requests, and processing jobs asynchronously in the background via pub/sub and queues.
jQuery is a popular JavaScript library that makes HTML document traversal and manipulation, event handling, animation, and Ajax interactions more simple. It works across browsers and allows developers to write less code using its easy-to-use API. The document discusses how jQuery works, including how to launch code on document ready, add and remove HTML classes, and use callbacks and functions when passing arguments to other functions.
The document discusses constructors and destructors in VB.NET. It explains that a constructor is called whenever a new object is created and is used to initialize the object. It has the name "New" and no return type. A destructor, called Finalize in VB.NET, is automatically called when an object is destroyed to perform cleanup tasks like closing files. Examples are provided to demonstrate default and parameterized constructors, as well as destructors.
Constructors in Java are special methods that are used to initialize objects. There are two types of constructors: default (no-arg) constructors that take no parameters, and parameterized constructors that allow passing parameters to initialize an object. Constructors must have the same name as the class and cannot have a return type. They are automatically called when an object is created using the new keyword to allocate memory and initialize fields.
Structures in C# are similar to classes but are value types stored on the stack. The document defines a Student struct with roll_number and Name properties, and shows how to declare a variable of the struct type, assign values to its properties, and copy one struct to another. Structs can also contain methods, as shown in the Rectangle struct example which defines a constructor, Area method, and Display method. Nested structs are also possible, like an Employee struct containing a nested Salary struct. The key differences between structs and classes are that structs are value types stored on the stack while classes are reference types.
Debugging in JavaScript
It is common to have errors while writing codes and the errors can be due to syntax or logical. These errors create a lot of ambiguity in the logic and understanding of both users and programmers. There can also be errors in the code which can remain invisible to the programmer’s eye and can create havoc. To identify these errors we need Debuggers that can go through the entire code or program, identify the errors and also fix them.
-Debugger
The debugger keyword is used in the code to force stop the execution of the code at a breaking point and calls the debugging function. The debugger function is executed if any debugging is needed at all else no action is performed.
The document discusses methods in C# programming. Some key points:
1. Methods are blocks of code that perform specific tasks and can be reused by calling the method multiple times. Parameters can pass data into methods.
2. To define a method, use the name followed by parentheses and place the method code inside curly braces. The method type (void, int, etc.) indicates if it returns a value.
3. Methods are called by writing the name followed by parentheses and passing arguments for any parameters. Parameters act as variables inside the method. Default parameter values can be specified.
4. Methods can return values using the return keyword, take multiple parameters, use named arguments, and be overloaded
This document provides an overview of ExpressJS, a web application framework for Node.js. It discusses using Connect as a middleware framework to build HTTP servers, and how Express builds on Connect by adding functionality like routing, views, and content negotiation. It then covers basic Express app architecture, creating routes, using views with different template engines like Jade, passing data to views, and some advanced topics like cookies, sessions, and authentication.
The document discusses the core components of an Android application including activities, services, broadcast receivers, and content providers. It describes how these components are declared in the manifest file and how they are activated via intents. The document also covers the application resources, project structure, and security model of Android applications.
Flutter es un SDK de Google para crear interfaces nativas de iOS y Android usando el lenguaje de programación Dart. Flutter 1.0 fue lanzado en diciembre de 2018 y usa programación declarativa para construir árboles de widgets que representan las interfaces. Los proyectos de Flutter contienen código Dart en la carpeta 'lib' y archivos de configuración para Android e iOS.
Event handling involves responding to user actions like clicking buttons or typing text. Events are generated by sources like buttons or keyboards and handled by listeners that implement specific event listener interfaces. The listener is registered with the source to receive notifications when events occur, then processes the event by implementing callback methods defined in the listener interface. Common types of events include action events, item events, and mouse events.
Servlet is java class which extends the functionality of web server by dynamically generating web pages.
Servlet technology is used to create Dynamic web application. Servlet technology is robust and scalable. init() and service() methods are more important in life cycle of a servlet. doGet() and doPost() are methods used under service() method.
- Angular modules help organize an application into blocks of related functionality. Modules declare components, directives, pipes and services that belong to that module.
- There are different types of modules like root modules, feature modules, and shared modules. The root module launches the app. Feature modules extend functionality. Shared modules contain reusable constructs.
- Modules can import and export specific constructs to make them available to other modules. Services declared in a module are singletons app-wide unless the module is lazy loaded. Core modules contain global services imported by the root module only.
The document discusses method overloading and overriding in .NET. Method overloading allows a method to have the same name but different parameters within a class. Method overriding involves a subclass redefining a method from its parent class with the same name and parameters. The key differences are that overloading is resolved at compile-time based on parameters, while overriding is resolved at run-time based on the object's type. Overriding changes existing functionality, while overloading adds or extends functionality.
Konsep View dan Blade dalam Laravel (Pemrograman Web II)I Gede Iwan Sudipa
View digunakan untuk menampilkan informasi ke pengguna dalam Laravel. View disimpan dalam folder resources/views dan menggunakan template Blade. Data dapat dikirim ke view dari controller menggunakan helper view. Blade template memungkinkan pengembangan tampilan yang fleksibel dengan fitur seperti penentuan layout, penggunaan yield dan section, serta struktur kontrol seperti if dan foreach.
The document provides an overview of JavaScript programming. It discusses the history and components of JavaScript, including ECMAScript, the DOM, and BOM. It also covers JavaScript basics like syntax, data types, operators, and functions. Finally, it introduces object-oriented concepts in JavaScript like prototype-based programming and early vs. late binding.
This document discusses delegates, anonymous methods, lambda expressions, and events in C#. Delegates allow encapsulating references to methods and functions. Anonymous methods provide a way to pass code blocks as delegates without needing separate methods. Lambda expressions create anonymous functions using the => operator. Events enable classes to notify other classes when something of interest occurs, with publishers raising events and subscribers handling them.
Tomcat is an open-source servlet container developed by the Apache Software Foundation that implements Java Servlet and JavaServer Pages technologies. It is written in Java and can run on several operating systems. Tomcat allows developers to deploy web applications and services built using Java technologies. The document provides examples of using servlets and JSPs with Tomcat and describes how to configure and deploy web applications on Tomcat.
Virtual functions allow functions to be overridden in derived classes. The virtual keyword before a function in the base class specifies that the function can be overridden. When a virtual function is called using a base class pointer, the version from the most derived class will be executed due to late binding. This allows runtime polymorphism where the function call is resolved based on the actual object type rather than the pointer variable type.
An app widget allows users to interact with an app's key functionality directly from their home screen. This document discusses what app widgets are, how the app widget framework works, and the steps to create an app widget, including declaring an AppWidgetProvider in the manifest, creating AppWidgetProviderInfo metadata and layout XML files, writing the AppWidgetProvider class, and optionally adding an app widget configuration activity.
Redis is an open source, advanced key-value store that can be used for caching, sessions, publishing/subscribing, job queues, and more. It supports atomic operations, ordered lists, sets, hashes and sorted sets. Data can be saved to disk for persistence. Redis has client libraries for many languages like Node.js and can be accessed via a command line interface. Popular use cases include caching application data to improve performance, storing sessions to allow user authentication across requests, and processing jobs asynchronously in the background via pub/sub and queues.
jQuery is a popular JavaScript library that makes HTML document traversal and manipulation, event handling, animation, and Ajax interactions more simple. It works across browsers and allows developers to write less code using its easy-to-use API. The document discusses how jQuery works, including how to launch code on document ready, add and remove HTML classes, and use callbacks and functions when passing arguments to other functions.
The document discusses constructors and destructors in VB.NET. It explains that a constructor is called whenever a new object is created and is used to initialize the object. It has the name "New" and no return type. A destructor, called Finalize in VB.NET, is automatically called when an object is destroyed to perform cleanup tasks like closing files. Examples are provided to demonstrate default and parameterized constructors, as well as destructors.
Constructors in Java are special methods that are used to initialize objects. There are two types of constructors: default (no-arg) constructors that take no parameters, and parameterized constructors that allow passing parameters to initialize an object. Constructors must have the same name as the class and cannot have a return type. They are automatically called when an object is created using the new keyword to allocate memory and initialize fields.
Structures in C# are similar to classes but are value types stored on the stack. The document defines a Student struct with roll_number and Name properties, and shows how to declare a variable of the struct type, assign values to its properties, and copy one struct to another. Structs can also contain methods, as shown in the Rectangle struct example which defines a constructor, Area method, and Display method. Nested structs are also possible, like an Employee struct containing a nested Salary struct. The key differences between structs and classes are that structs are value types stored on the stack while classes are reference types.
Debugging in JavaScript
It is common to have errors while writing codes and the errors can be due to syntax or logical. These errors create a lot of ambiguity in the logic and understanding of both users and programmers. There can also be errors in the code which can remain invisible to the programmer’s eye and can create havoc. To identify these errors we need Debuggers that can go through the entire code or program, identify the errors and also fix them.
-Debugger
The debugger keyword is used in the code to force stop the execution of the code at a breaking point and calls the debugging function. The debugger function is executed if any debugging is needed at all else no action is performed.
The document discusses methods in C# programming. Some key points:
1. Methods are blocks of code that perform specific tasks and can be reused by calling the method multiple times. Parameters can pass data into methods.
2. To define a method, use the name followed by parentheses and place the method code inside curly braces. The method type (void, int, etc.) indicates if it returns a value.
3. Methods are called by writing the name followed by parentheses and passing arguments for any parameters. Parameters act as variables inside the method. Default parameter values can be specified.
4. Methods can return values using the return keyword, take multiple parameters, use named arguments, and be overloaded
This document provides an overview of ExpressJS, a web application framework for Node.js. It discusses using Connect as a middleware framework to build HTTP servers, and how Express builds on Connect by adding functionality like routing, views, and content negotiation. It then covers basic Express app architecture, creating routes, using views with different template engines like Jade, passing data to views, and some advanced topics like cookies, sessions, and authentication.
The document discusses the core components of an Android application including activities, services, broadcast receivers, and content providers. It describes how these components are declared in the manifest file and how they are activated via intents. The document also covers the application resources, project structure, and security model of Android applications.
Flutter es un SDK de Google para crear interfaces nativas de iOS y Android usando el lenguaje de programación Dart. Flutter 1.0 fue lanzado en diciembre de 2018 y usa programación declarativa para construir árboles de widgets que representan las interfaces. Los proyectos de Flutter contienen código Dart en la carpeta 'lib' y archivos de configuración para Android e iOS.
Event handling involves responding to user actions like clicking buttons or typing text. Events are generated by sources like buttons or keyboards and handled by listeners that implement specific event listener interfaces. The listener is registered with the source to receive notifications when events occur, then processes the event by implementing callback methods defined in the listener interface. Common types of events include action events, item events, and mouse events.
Servlet is java class which extends the functionality of web server by dynamically generating web pages.
Servlet technology is used to create Dynamic web application. Servlet technology is robust and scalable. init() and service() methods are more important in life cycle of a servlet. doGet() and doPost() are methods used under service() method.
- Angular modules help organize an application into blocks of related functionality. Modules declare components, directives, pipes and services that belong to that module.
- There are different types of modules like root modules, feature modules, and shared modules. The root module launches the app. Feature modules extend functionality. Shared modules contain reusable constructs.
- Modules can import and export specific constructs to make them available to other modules. Services declared in a module are singletons app-wide unless the module is lazy loaded. Core modules contain global services imported by the root module only.
The document discusses method overloading and overriding in .NET. Method overloading allows a method to have the same name but different parameters within a class. Method overriding involves a subclass redefining a method from its parent class with the same name and parameters. The key differences are that overloading is resolved at compile-time based on parameters, while overriding is resolved at run-time based on the object's type. Overriding changes existing functionality, while overloading adds or extends functionality.
Konsep View dan Blade dalam Laravel (Pemrograman Web II)I Gede Iwan Sudipa
View digunakan untuk menampilkan informasi ke pengguna dalam Laravel. View disimpan dalam folder resources/views dan menggunakan template Blade. Data dapat dikirim ke view dari controller menggunakan helper view. Blade template memungkinkan pengembangan tampilan yang fleksibel dengan fitur seperti penentuan layout, penggunaan yield dan section, serta struktur kontrol seperti if dan foreach.
Laravel adalah framework PHP yang gratis dan terbuka untuk membangun aplikasi web berbasis MVC. Laravel memiliki komponen-komponen seperti route, controller, Eloquent ORM, view, dan lainnya. Route digunakan untuk memetakan URL ke fungsi controller, controller berinteraksi dengan model dan mengembalikan nilai ke klien, sedangkan view digunakan untuk merepresentasikan tampilan yang diberikan kepada pengguna.
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.
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.
Modul 2 Cara Membuat Controller Pada CodeIgniterRiki Afriansyah
Modul ini menjelaskan cara membuat controller pada CodeIgniter. Controller adalah jantung aplikasi karena menentukan bagaimana permintaan HTTP ditangani. Controller dibuat sebagai file PHP di folder application/controllers dengan nama sama dengan kelasnya. Segment URL mencerminkan controller yang dipanggil. Controller baru dibuat dengan membuat file PHP baru di folder controllers dan mendefinisikan kelas baru di dalamnya.
Tutorial ini menjelaskan 7 langkah untuk membuat modul download katalog pada CMS Toko Lokomedia, meliputi pembuatan tabel baru, penambahan modul di admin, membuat skrip modul, memanggil modul di admin, membuat skrip untuk pengunjung, menambahkan rule .htaccess, dan menambahkan menu.
Dokumen tersebut membahas tentang dasar-dasar penggunaan URI dan controller dalam CodeIgniter. CodeIgniter mendukung penggunaan URI berbasis segmen maupun query string, dan controller digunakan sebagai gerbang awal akses sumber daya aplikasi melalui URI.
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 tersebut membahas tentang metode pengiriman form (POST dan GET) serta penggunaan session dalam PHP. Metode POST menyembunyikan variabel yang dikirim di alamat web, sedangkan metode GET menampilkan variabelnya. Session digunakan untuk menyimpan sementara variabel antar halaman dengan mendaftarkan, mengisi, dan menampilkan variabel session. Contoh koding mendemonstrasikan penggunaan form dengan metode POST, penyimpanan variabel ke session, dan penampil
Bab 1 membahas tentang pengenalan dan instalasi Laravel. Terdapat penjelasan mengenai sejarah, konsep MVC, software pendukung, dan cara instalasi Laravel beserta struktur folder-nya.
Dokumen tersebut membahas tentang penggunaan database dalam PHP dengan MySQL. Topik utama yang dibahas adalah konfigurasi koneksi antara PHP dan MySQL, penggunaan perintah SQL dasar seperti INSERT, SELECT, UPDATE, dan DELETE untuk mengolah data di database, serta contoh kode PHP untuk melakukan koneksi dan mengakses data di database MySQL.
Dokumen tersebut membahas berbagai jenis perulangan dalam PHP seperti for, while, do-while, foreach, serta penggunaan break, continue, exit, dan return untuk mengontrol alur eksekusi perulangan. Dokumen tersebut juga menjelaskan konsep array dan berbagai fungsi yang terkait dengan array dalam PHP."
Dokumen tersebut membahas tentang pemrograman web 1 yang mencakup penjelasan tentang template sintaks PHP, penggunaan file index, struktur kontrol program seperti kondisi dan pernyataan if-else-if serta switch-case, serta contoh kode program menggunakan berbagai struktur kontrol tersebut.
Dokumen tersebut membahas tentang Internet, World Wide Web, URL, DNS, web browser, server dan client, serta bahasa pemrograman server-side dan client-side. HTML dibahas sebagai bahasa markup standar untuk membuat halaman web dan menampilkan berbagai informasi. Struktur dasar HTML dan tag-tag dasarnya dijelaskan secara singkat."
Normalisasi adalah proses pembentukan struktur database untuk menghilangkan ambiguitas seperti redundansi dan anomali agar database dapat dioptimalkan. Terdapat tiga jenis anomali yaitu delete, insert, dan update anomaly yang dapat terjadi akibat manipulasi data yang tidak sesuai. Dekomposisi digunakan untuk memecah relasi menjadi bagian-bagian lebih kecil guna mencegah terjadinya anomali dan redundansi data.
Dokumen tersebut membahas tentang entitas, atribut, dan relasi dalam basis data. Entitas menunjukkan objek yang terkait dalam sistem seperti mahasiswa, dosen, dan mata kuliah. Atribut memberikan informasi tambahan tentang entitas seperti NIM dan nama mahasiswa. Relasi mendefinisikan hubungan antar entitas seperti mahasiswa mengikuti mata kuliah dan dosen mengajar mata kuliah. Jenis relasi meliputi satu ke satu, satu ke banyak, b
Dokumen tersebut membahas tentang hirarki dan abstraksi data dalam sistem basis data. Secara singkat, dokumen menjelaskan bahwa data dapat disusun dalam hirarki berdasarkan tingkat kompleksitasnya, mulai dari bit, byte, data item, record, file, hingga sistem basis data secara keseluruhan. Dokumen juga menjelaskan tiga tingkatan abstraksi data yaitu view pengguna, pandangan konseptual, dan pandangan fisik.
4. CONTROLLER
Betugas untuk memproses semua request, baik itu berupa
logic, database atau view
Controller dapat mengelompokkan beberapa request terkait
ke dalam satu class
Terletak di folder app/Http/Controller
7. NAMESPACE
Jika ada pengelompokan controller lebih dalam untuk
diletakkan pada sub folder di folder app/HTTP/Controller, maka
penulisan class controller harus ditulis lebih spesifik
Contoh
Route::get(‘url’,’subfoldercontroller@method’);
8. SINGLE ACTION CONTROLLER
Jika hanya dibuat satu action saja
pada controller, maka hanya
digunakan method __invoke pada
controller
Route::get('test/{id}','testControl
ler');
9. MENGAKSES FUNGSI BERBEDA
Method this ini menandakan kita akan memanggil fungsi yang ada
di dalam satu controller yang sama
Fungsi yang tidak melakukan return value
$this->nama_fungsi();
Fungsi yang melakukan return value perlu mendefinisikan suatu
variabel sebelum memanggil fungsi tersebut untuk tempat
menyimapan return value dari fungsi yang diakses
$var = $this->nama_fungsi();
10.
11. RESOURCE CONTROLLER
Fitur laravel yang memudahkan dalam membuat route untuk
CRUD pada controller dengan perintah satu baris
Misalkan membuat sebuah controller untuk menangani
request yang berhubungan dengan penyimpanan “Foto” di
aplikasi
12. RESOURCE CONTROLLER
Buat resource controller
php artisan make:controller NamaController --resource
Membuat resource controller secara otomatis
13.
14. METHOD RESOURCE
index() digunakan untuk menampilakan data awal
create() digunakan untuk menampilkan form tambah
store() digunakan untuk proses penyimpanan data
edit() yang digunakan untuk menampilkan form edit
update() juga digunakan untuk proses pembaruan data
show() digunakan untuk menampilkan data detail
destroy() digunakan untuk menghapus data dari database
18. PARTIAL RESOURCE
Memilih method apa saja yang akan digunakan atau tidak akan
digunakan
Route::resource(‘photos', ‘PhotoController', [
'only' => ['create', 'store', 'show']
]);
Membutuhkan method tertentu saja
20. NAMING RESOURCE ROUTES
Secara default semua resource controller mempunyai nama, jika
ingin melakukan perubahan dapat melakukan override dengan
menggunakan names
Route::resource(‘photos', ‘PhotosController', [
‘names’ => [‘create' => ‘photos.build‘]
]);
24. LATIHAN
Dengan menggunakan konsep MVC, buatlah sebuah controller
yang dapat menampilkan data produk dimana data yang
diambil dari sebuah fungsi di class yang sama