MK Pemrograman Berbasis Web Temu#13 Moch Diki WIdianto Prodi Informatika

Share

Summary

This video, part of the Web-Based Programming course, focuses on implementing CRUD (Create, Read, Update, Delete) operations using PHP frameworks, specifically CodeIgniter and Laravel. It covers setting up projects, creating migrations, models, and controllers, and building user interfaces. The tutorial also touches on enhancing the UI with Tailwind CSS.

Highlights

Introduction to CRUD in PHP Frameworks (CodeIgniter & Laravel)
00:00:00

The video introduces the 13th meeting of the Web-Based Programming course, focusing on PHP frameworks CodeIgniter and Laravel. The main objective is to understand and implement CRUD (Create, Read, Update, and Delete) operations using the Model-View-Controller (MVC) concept. The instructor, Muhammad Widianto, outlines the learning goals: comprehending CRUD concepts in frameworks and implementing them with CodeIgniter or Laravel. The session builds upon previous lessons, including environment setup, migrations, and seeders, and transitions into SCR (Source Code Review).

Implementing CRUD with CodeIgniter - Setup and Create Operation
00:01:49

The first section of the practical implementation demonstrates CRUD with CodeIgniter. It starts by running a CodeIgniter project and reviewing existing routes. The instructor then guides through creating a new 'product' module. This involves generating a migration for the 'products' table, defining its columns (ID, code, name, stock), and running the migration. Subsequently, a 'ProductModel' is created to interact with the database, and a 'ProductController' is developed. The 'index' function in the controller is set up to display a list of products, and a 'create' function and corresponding view are developed to add new products to the database, including validation and saving data.

Implementing CRUD with CodeIgniter - Read, Update, and Delete Operations
00:16:00

Continuing with CodeIgniter, the video demonstrates how to display existing product data. The 'index' view is enhanced to loop through product data retrieved from the 'ProductModel' and display it in a table format. For the 'Update' operation, an 'edit' function and view are created, allowing users to modify existing product details. This involves fetching product data by ID, populating the edit form, and submitting changes to an 'update' function in the controller. Finally, the 'Delete' operation is implemented with a 'destroy' function, which removes a product from the database based on its ID. The video shows successful creation, reading, updating, and deleting of product records.

Implementing CRUD with Laravel - Project Setup and Database Migration
00:23:28

The tutorial then shifts to Laravel. It begins by creating a new Laravel project using Composer. The instructor emphasizes checking PHP and Composer versions for compatibility. After project creation, the process involves configuring the '.env' file, specifically setting up the database connection details (MySQL/MariaDB username, password, and database name). A new database named 'DB Laravel' is created, and 'php artisan key:generate' is run to generate an application key. The default Laravel migrations are then executed to create essential tables like 'users' and 'sessions'. This ensures the initial Laravel setup is functional.

Implementing CRUD with Laravel - Models, Controllers, and Basic Views
00:29:31

The Laravel section continues with creating a 'products' table migration, similar to CodeIgniter, defining columns like code, name, and stock, and running the migration. A 'Product' model is then generated, and its 'fillable' properties (code, name, stock) are defined. The video highlights the difference in routing between CodeIgniter (roots.php) and Laravel (web.php). A 'ProductController' is created, and an 'index' function is implemented to fetch all products using the 'Product' model and pass them to an 'index.blade.php' view. A 'create' function and its corresponding 'create.blade.php' view are also set up to facilitate adding new products, including form validation and saving data.

Implementing CRUD with Laravel - Update, Delete, and UI Enhancements
00:41:55

The final part of the Laravel CRUD implementation covers updating and deleting products. An 'edit' function in the 'ProductController' is created to retrieve a specific product by ID and display its details in an 'edit.blade.php' view. This form allows users to modify product information. The 'update' function then handles saving these changes to the database. For deleting, a 'destroy' function is implemented to remove products. The video demonstrates the full CRUD cycle with Laravel. Lastly, the instructor briefly shows how to integrate Tailwind CSS into the Laravel project to improve the visual appeal of the forms and tables, transforming basic HTML elements into more polished UI components.

Assignment and Conclusion
00:50:28

The video concludes by assigning a task to students: create a summarized video (minimum 5 minutes) of the 13th meeting, focusing on practicing CRUD implementation with both CodeIgniter and Laravel, and upload it to YouTube. The link to this resume video should be submitted on Google Classroom within one week or before the next meeting. This assignment aims to reinforce the concepts and practical skills learned during the session.

Recently Summarized Articles

Loading...