1
I’m trying to perform operation Insert on the oracle by Laravel (5.6), but is giving error:
The method I do the Insert is this:
public function salvar( Request $request ){
$agenda = new Agenda();
$agenda->dt_agenda = $request->input('data');
$agenda->hr_agenda = $request->input('hora');
$agenda->nm_pessoa = $request->input('nome');
$agenda->save();
$data = date('d/m/Y');
return view('escala')->with( 'data', $data );
}
The config/database.php file looks like this:
'default' => env('DB_CONNECTION', 'oracle'),
...
'oracle' => [
'driver' => 'oracle',
'host' => env('DB_HOST', ''),
'port' => env('DB_PORT', '1521'),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'AL32UTF8'),
'prefix' => ''
],
The file . env is properly configured
DB_CONNECTION=oracle
DB_HOST=ipdoservidor
DB_PORT=1521
DB_DATABASE=banco
DB_USERNAME=login
DB_PASSWORD=senha
The mistake you’re making is :
Errorexception (E_WARNING) Declaration of Yajra Oci8 Oci8connection::causedByLostConnection(Exception $e) should be compatible with Illuminate Database Connection::causedByLostConnection(Throwable $e)
My Composer.json looks like this:
"require": {
"php": ">=7.1.3",
"barryvdh/laravel-ide-helper": "^2.4",
"fideloper/proxy": "~4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "~1.0",
"yajra/laravel-oci8": "5.6.*"
},
True, I changed the json file to 5.5 and it worked.
– adventistaam