-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error: Uncaught InvalidArgumentException: Unsupported driver #35
Comments
Hi @wfsdaj, thanks for trying out Leaf. First of all, can you give me some information on your setup? Are you using Leaf on it's own or something like Leaf MVC/Leaf API? |
Also, Leaf Models run on eloquent, and not |
@mr-phlames thank you for your reply. I use Leaf. I can use the db class normally on the index page. leaf/index.php require __DIR__ . "/vendor/autoload.php";
$app = new Leaf\App();
require __DIR__ . "/config/app.php";
require __DIR__ . "/app/routes.php";
$users = $db->select("users", "id, name")->fetchObj();
echo $users->id; //output 1
$app->run(); |
Yes the DB class just provides a simple way to use your database. Something you can work with anywhere in your code without worrying about models and stuff like that. So in that case, is you problem resolved or do you still have issues with the database? |
Yes, there are still errors. 😅 |
Can you confirm something for me? Do you have a |
my /.env file
my /config/app.php $app->config([
'mode' => 'development',
'debug' => true,
'templates.path' => './views',
'log.enabled' => true,
'cookies.path' => '/',
'cookies.encrypt' => true,
'cookies.lifetime' => '20 minutes',
]); |
And are you correctly loading the |
I thought the .env file was automatically loaded just like laravel。 |
Yeah, that should be the easiest way. Env files are loaded automatically only if you use something like leaf MVC or leaf API. |
I am a Chinese user, can not speak English, or a PHP rookie, this is using Google automatic translation, I apologize first. I encountered an error using the model, What did I do wrong?
My program code:
App\Controllers\UserController.php
App\Models\User.php
My database connection:
The text was updated successfully, but these errors were encountered: