Can Laravel 4 log to a MySQL database?
Tag : php , By : nobodyzzz
Date : March 29 2020, 07:55 AM
like below fixes the issue If so how can it be done? By default L4 writes to a text file. I notice that Monolog can Log to Database on its github page. , Yep, You could create a listener to log everything in the routes.php Event::listen('laravel.log', function($type,$message)
{
$log = new Log();
$log->message = $message;
$log->type = $type;
$log->update;
});
Event::listen('404', function()
{
$error = "404: " . URL::full();
Log::error($error);
$update = new Log();
$update->error = $error;
$update->update;
return Response::error('404');
});
Event::listen('500', function()
{
Log::error($error);
$update = new Log();
$update->error = $error;
$update->update;
return Response::error('500');
});
|
Laravel 5: Error: "Driver not found" while migrating the database(mysql) in laravel
Tag : php , By : lamberms
Date : March 29 2020, 07:55 AM
will be helpful for those in need It's been around 5-6 hours since I've been trying to use database in laravel 5. , Finally, at last! it worked!! In php.ini file:
|
laravel 5 dynamic mysql database
Tag : php , By : Arun Thakkar
Date : March 29 2020, 07:55 AM
this one helps. how can I change the database in Laravel dynamic? Lets say we have the following variables: , Try this assuming a model Book use Book;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Config;
public function configureDatabase($database){
Config::set("database.connections.$database", array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => "$database",
'username' => 'root',//User name here
'password' => '***', //Password here
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
));
}
public function getBooks($database){
$this->configureDatabase($database)
return Book::on($database)->all();
}
|
i'm connect multiple Database and i use Laravel Excel I can'n export. This is error "Database [mysql] not configure
Date : March 29 2020, 07:55 AM
around this issue i'm connect multiple Database and i use Laravel Excel I can'n export. This is error "Database [mysql] not configured." , I succeeded too. app/Exports namespace App\Exports;
use App\MerakiBluetoothTemp;
use Maatwebsite\Excel\Concerns\FromCollection;
use App\Http\Controllers\Controller;
class merakiExport extends Controller implements FromCollection
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return MerakiBluetoothTemp::all();
}
}
|
How do I connect to a MySQL database over SSL with Laravel 5.3
Date : March 29 2020, 07:55 AM
|