<?php
use Illuminate\Database\ConnectionResolver;
use Illuminate\Database\Connection;
use Illuminate\Database\Query\Grammars\MySqlGrammar;
$pdo = new PDO('mysql:dbname=eloquent;host=127.0.0.1');
$connection = new Connection($pdo);
$connection->enableQueryLog();
$connection->setQueryGrammar(new MySqlGrammar());
$resolver = new ConnectionResolver([
'default' => $connection,
]);
Test::setConnectionResolver($resolver);
$test = Test::find(1);
echo $test['name'];
$test['name'] = 'newname';
if ($test->isDirty()) {
dump($test->save());
}
echo $test['name'];
^ true