I have a live project that I do not really want to touch, so I do not want to amend anything like the routes file. What I need to do is create a type of test file that checks that the connection to the database is fine.
So within my public folder, I have created a plain PHP file. I do not want to use php functions as I need to replicate what Laravel does. What I am essentially trying to do is something like this
<?php
require __DIR__.'/../bootstrap/autoload.php';
if(DB::connection()->getDatabaseName())
{
print_r("Yes! successfully connected to the DB: " . DB::connection()->getDatabaseName());
} else {
print_r("Cant connect");
}
Would it be possible to do this directly from the public folder in a standalone PHP file?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire