Skip to main content

Prueba esta configuración, espero que te ayude.

.ENV

DB_CONNECTION=sqlsrv
DB_HOST=MY_sERVER\SQLEXPRESS
DB_DATABASE=my_db
DB_USERNAME=sa
DB_PASSWORD=your_password

config/database.php

'sqlsrv' => [
        'driver' => 'sqlsrv',
        'url' => env('DATABASE_URL'),
        'host' => env('DB_HOST', null),
        'port' => env('DB_PORT'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'prefix_indexes' => true,
    ],

CONSULTA

public function index(Request $request)
{
DB::statement('EXECUTE sp_sm_U_sistemastiposplan ?,?,?,?,?,?,?,?,?',
                [
                    null,
                    $request->codigoSistema,
                    $request -> codigoTipoPlan[$i],
                    1,
                    $request -> formatos[$i],
                    Auth::user()->id,
                    null,
                    null,
                    Auth::user()->id,
                ]);
}

.ENV

DB_CONNECTION=sqlsrv
DB_HOST=MY_sERVER\SQLEXPRESS
DB_DATABASE=my_db
DB_USERNAME=sa
DB_PASSWORD=your_password

config/database.php

'sqlsrv' => [
        'driver' => 'sqlsrv',
        'url' => env('DATABASE_URL'),
        'host' => env('DB_HOST', null),
        'port' => env('DB_PORT'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'prefix_indexes' => true,
    ],

CONSULTA

public function index(Request $request)
{
DB::statement('EXECUTE sp_sm_U_sistemastiposplan ?,?,?,?,?,?,?,?,?',
                [
                    null,
                    $request->codigoSistema,
                    $request -> codigoTipoPlan[$i],
                    1,
                    $request -> formatos[$i],
                    Auth::user()->id,
                    null,
                    null,
                    Auth::user()->id,
                ]);
}

Prueba esta configuración, espero que te ayude.

.ENV

DB_CONNECTION=sqlsrv
DB_HOST=MY_sERVER\SQLEXPRESS
DB_DATABASE=my_db
DB_USERNAME=sa
DB_PASSWORD=your_password

config/database.php

'sqlsrv' => [
        'driver' => 'sqlsrv',
        'url' => env('DATABASE_URL'),
        'host' => env('DB_HOST', null),
        'port' => env('DB_PORT'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'prefix_indexes' => true,
    ],

CONSULTA

public function index(Request $request)
{
DB::statement('EXECUTE sp_sm_U_sistemastiposplan ?,?,?,?,?,?,?,?,?',
                [
                    null,
                    $request->codigoSistema,
                    $request -> codigoTipoPlan[$i],
                    1,
                    $request -> formatos[$i],
                    Auth::user()->id,
                    null,
                    null,
                    Auth::user()->id,
                ]);
}
Origen Enlace

.ENV

DB_CONNECTION=sqlsrv
DB_HOST=MY_sERVER\SQLEXPRESS
DB_DATABASE=my_db
DB_USERNAME=sa
DB_PASSWORD=your_password

config/database.php

'sqlsrv' => [
        'driver' => 'sqlsrv',
        'url' => env('DATABASE_URL'),
        'host' => env('DB_HOST', null),
        'port' => env('DB_PORT'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'prefix_indexes' => true,
    ],

CONSULTA

public function index(Request $request)
{
DB::statement('EXECUTE sp_sm_U_sistemastiposplan ?,?,?,?,?,?,?,?,?',
                [
                    null,
                    $request->codigoSistema,
                    $request -> codigoTipoPlan[$i],
                    1,
                    $request -> formatos[$i],
                    Auth::user()->id,
                    null,
                    null,
                    Auth::user()->id,
                ]);
}