1. Go to this page and download the library: Download khalidmh/eloquent-sql library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
khalidmh / eloquent-sql example snippets
use KhalidMh\EloquentSQL\EloquentSQL;
use App\Models\User;
$user = User::find(1);
$sql = EloquentSQL::set($user)->toQuery();
// Output: INSERT INTO `users` (`id`, `name`, `email`, ...) VALUES (1, 'John Doe', '[email protected]', ...);
use KhalidMh\EloquentSQL\EloquentSQL;
use App\Models\User;
$user = User::find(1);
$sql = EloquentSQL::set($user)
->except(['id', 'created_at', 'updated_at'])
->toQuery();
// Output: INSERT INTO `users` (`name`, `email`, ...) VALUES ('John Doe', '[email protected]', ...);
use KhalidMh\EloquentSQL\EloquentSQL;
use App\Models\User;
$user = User::find(1);
$sql = EloquentSQL::set($user)
->only(['name', 'email'])
->toQuery();
// Output: INSERT INTO `users` (`name`, `email`) VALUES ('John Doe', '[email protected]');
use KhalidMh\EloquentSQL\EloquentSQL;
use App\Models\User;
$user = User::find(1);
$sql = EloquentSQL::set($user)
->ken`) VALUES ('password', '8zfuGf0f....');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.