Overview

Namespaces

  • None
  • Yajra
    • Oci8
      • Auth
      • Connectors
      • Eloquent
      • Query
        • Grammars
        • Processors
      • Schema
        • Grammars

Classes

  • Yajra\Oci8\Auth\OracleUserProvider
  • Yajra\Oci8\Connectors\OracleConnector
  • Yajra\Oci8\Eloquent\OracleEloquent
  • Yajra\Oci8\Oci8Connection
  • Yajra\Oci8\Oci8ServiceProvider
  • Yajra\Oci8\Query\Grammars\OracleGrammar
  • Yajra\Oci8\Query\OracleBuilder
  • Yajra\Oci8\Query\Processors\OracleProcessor
  • Yajra\Oci8\Schema\Comment
  • Yajra\Oci8\Schema\Grammars\OracleGrammar
  • Yajra\Oci8\Schema\OracleAutoIncrementHelper
  • Yajra\Oci8\Schema\OracleBlueprint
  • Yajra\Oci8\Schema\OracleBuilder
  • Yajra\Oci8\Schema\Sequence
  • Yajra\Oci8\Schema\Trigger

Traits

  • Yajra\Oci8\OracleReservedWords

Functions

  • config_path
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace Yajra\Oci8;
 4: 
 5: use Illuminate\Support\ServiceProvider;
 6: use Yajra\Oci8\Auth\OracleUserProvider;
 7: use Yajra\Oci8\Connectors\OracleConnector as Connector;
 8: use Illuminate\Support\Facades\Auth;
 9: 
10: class Oci8ServiceProvider extends ServiceProvider
11: {
12:     /**
13:      * Indicates if loading of the provider is deferred.
14:      *
15:      * @var bool
16:      */
17:     protected $defer = false;
18: 
19:     /**
20:      * Boot Oci8 Provider
21:      */
22:     public function boot()
23:     {
24:         $this->publishes([
25:             __DIR__ . '/../config/oracle.php' => config_path('oracle.php'),
26:         ], 'oracle');
27: 
28:         Auth::provider('oracle', function ($app, array $config) {
29:             return new OracleUserProvider($app['hash'], $config['model']);
30:         });
31:     }
32: 
33:     /**
34:      * Register the service provider.
35:      *
36:      * @return void
37:      */
38:     public function register()
39:     {
40:         if (file_exists(config_path('oracle.php'))) {
41:             $this->mergeConfigFrom(config_path('oracle.php'), 'database.connections');
42:         } else {
43:             $this->mergeConfigFrom(__DIR__ . '/../config/oracle.php', 'database.connections');
44:         }
45: 
46:         $this->app['db']->extend('oracle', function ($config) {
47:             $connector  = new Connector();
48:             $connection = $connector->connect($config);
49:             $db         = new Oci8Connection($connection, $config["database"], $config["prefix"], $config);
50: 
51:             if (! empty($config['skip_session_vars'])) {
52:                 return $db;
53:             }
54: 
55:             // set oracle session variables
56:             $sessionVars = [
57:                 'NLS_TIME_FORMAT'         => 'HH24:MI:SS',
58:                 'NLS_DATE_FORMAT'         => 'YYYY-MM-DD HH24:MI:SS',
59:                 'NLS_TIMESTAMP_FORMAT'    => 'YYYY-MM-DD HH24:MI:SS',
60:                 'NLS_TIMESTAMP_TZ_FORMAT' => 'YYYY-MM-DD HH24:MI:SS TZH:TZM',
61:                 'NLS_NUMERIC_CHARACTERS'  => '.,',
62:             ];
63: 
64:             // Like Postgres, Oracle allows the concept of "schema"
65:             if (isset($config['schema'])) {
66:                 $sessionVars['CURRENT_SCHEMA'] = $config['schema'];
67:             }
68: 
69:             $db->setSessionVars($sessionVars);
70: 
71:             return $db;
72:         });
73:     }
74: 
75:     /**
76:      * Get the services provided by the provider.
77:      *
78:      * @return string[]
79:      */
80:     public function provides()
81:     {
82:         return [];
83:     }
84: }
85: 
API documentation generated by ApiGen