13. Laravel — Working with Database Laravel Connecting to Database Laravel has made processing with database very easy. Laravel currently supports following 4 databases: MySQL Postgres SQLite SQL Server The query to the database can be fired using raw SQL, the fluent query builder, and the Eloquent ORM. To understand the all CRUD (Create, Read, Update, Delete) operations with Laravel, we will use simple student management system. Configure the database in config/database.php file and create the college database with structure in MySQL as shown in the following table. Database: College Table: student Column Name Column Datatype Extra Id int(11) Primary key | Auto increment Name varchar(25) We will see how to add, delete, update and retrieve records from database using Laravel in student table. Insert Records We can insert the record using the DB facade with insert method. The syntax of insert method is as shown in the following table. Syntax Parameters Returns Description bool insert(string $query, array $bindings = array()) bool $query(string) – query to execute in database $bindings(array) – values to bind with queries Run an insert statement against the database. 64
Laravel Example Step 1: Execute the below command to create a controller called StudInsertController php artisan make:controller StudInsertController --plain Step 2: After successful execution, you will receive the following output: Step 3: Copy the following code to file app/Http/Controllers/StudInsertController.php app/Http/Controllers/StudInsertController.php
Download Authentic Zend 200-550 Exam Questions Answers PDF: https://authenticdumps.com/dumps/200-550/
20% Discount: Use this Coupon [SAVE20]
AuthenticDumps.com Provides 100% Updated Zend 200-550 Exam Questions and it's actual Answers which are verified Zend Experts. Zend 200-550 Exam Dumps PDF is a recommended way to pass your 200-550 Exam with High Marks. Visit AuthenticDumps.com to Get more information about 200-550 exam.