If you are working on laravel framwork and you use query builder of laravel 5. but you want to get last executed mysql query from laravel. If you are working on laravel 5 then you have to first enable query log that way it can be store query log. At last getQueryLog() through you can get last executed query.
I give you example of how to get last executed mysql query. you can use example as following example.
public function querylog()
$item = Item::find(2);
$last_query = DB::getQueryLog();
You are working on laravel with mysql database. you had created mysql procedure for get data and you want to call procedure with pagination in laravel 5 then you can not directly make pagination as laravel document.If you are using directly MySQL stored Procedure in your controller, model or repository and you want to give pagination like this way :
$data = DB::select(DB::raw('CALL hardik("hari")'))->paginate(5);
This way you found error in your Laravel 5 website. we can't give directly this way pagination because your procedure will get all the data fr.....
If you want to store IP address in mysql database then don’t mistake to use varchar datatype because you can use INT UNSIGNED 4(BYTE) datatype. using integer datatype you can save more space in database.
when you fire insert query at that time use INET_ATON() and select query at that time INET_NTOA() use. how to use this function given bellow example.
<strong>Create Table : </strong>
CREATE TABLE IF NOT EXISTS `ip_addresses` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ip_address` INT(4) UNSIGNED NOT NULL,
PRIMARY KEY (`id`)
If you have thousands of record store, that time database size would be large. but you can some field can save your number of bites in the database.
you have color field then most of you choose string(6) data type and you wast 6 bites on every record, but you can save number of bites data by using BINARY(3) data type. following example through you can set data type for hexa color code with only allocate binary(3) on every records. first how to create table and assign data type with following query.
CREATE TABLE IF NOT EXISTS `colors` (
`id` int(10) unsigned NOT N.....