Showing posts with label laravel 5. Show all posts
Showing posts with label laravel 5. Show all posts

Laravel eloquent relationships


In laravel you can define all kind of relationships between database tables on the model itself (as in laravel, model is representation of database table), so here's list of eloquent relationships that you can use in laravel model.

Laravel eager loading example


One of the benefit of using laravel is that you can do eager loading relationship in the model when using eloquent, in this article i'm going to show example of eager load in laravel.

Insert using DB table doesnt update timestamp


In laravel there are two ways to insert data/record, using DB table or using model, but i found a problem when inserting the data using DB table, the timestamp created_at and updated_at is showing '0000-00-00 00:00:00' as value.

How to update timestamp in Laravel


In laravel usually you have created_at and updated_at field in your database table, these are timestamps() that you define in your laravel migration, the question is how to update the value of these timestamp specially the updated_at?

How to add primary key to Laravel model?


If you did not specify primary key in your model, laravel will assume the primary key of the table is 'id', so for example your primary key is not 'id', but let's say 'user_id' or 'employee_id' etc, how to define this in the model?

How to insert, update and delete in Laravel


If you are just learning about laravel, meaning you are beginner of laravel, you probably want to know about how to do insert, update and delete record of a database table in laravel. If you are beginner this short tutorial is for you.

How to get raw SQL query in Laravel


Using eloquent in laravel is very convenient, but sometimes you want to know the raw SQL query that's executed behind the scene, so how to get raw SQL query from laravel eloquent?

How to do insert using DB table in Laravel

How to do insert using DB table in Laravel

In laravel you can insert data to a table in two ways, the first one and the most common is using a model, create a model for that table and then insert the data, the second way is using DB::table(), in this article i will show you how to insert to database table using DB::table().

How to do raw query in Laravel


Besides the standard methods for database query that are available on laravel, you also have an option to do raw query, in this article i will show you how to do raw database query in laravel.

Laravel query builder example


Instead of hand coding SQL code on your application, you should try to use query builder in laravel, in this article i will show some of the query builder example, so you can learn them.

Mass assignment technique in Laravel


When you learn about laravel, you probably heard about mass assignment, what does it mean? what exactly is mass assignment? should you care about it?

php artisan migrate command in Laravel


The 'php artisan migrate' command lets you run the database migration on your application, but there is more than that, there are other variant of this command that you can use such as rollback, reset, refresh, status, install and so on.

How to add and drop indexes in Laravel schema builder


On your laravel database migration you can define indexes for each table that you create, for example you can add primary key, unique value, or just a basic index. All can be done in laravel schema builder.

How to check table column exist or not in Laravel


Besides the 'hasTable' static method, you also have 'hasColumn' method which can check column exist or not on database table of laravel.

How to check table exist or not in Laravel


Is it possible to check existence of database table in laravel code? the answer is yes, it is possible to check whether a table already exist or not in laravel.

Laravel 4.2 schema table column types


These are list of schema table column types that you can use when creating database migration on laravel 4.2, most of these column types also available on laravel 5, this post is just for quick reference.

Category

Category