Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
b1ed1667
Commit
b1ed1667
authored
Jan 05, 2018
by
Steve Porter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: support dsn strings with and without mongodb prefix
parent
c3b622ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
Connection.php
src/Jenssegers/Mongodb/Connection.php
+10
-3
No files found.
src/Jenssegers/Mongodb/Connection.php
View file @
b1ed1667
...
...
@@ -4,6 +4,7 @@ namespace Jenssegers\Mongodb;
use
Illuminate\Database\Connection
as
BaseConnection
;
use
Illuminate\Support\Arr
;
use
Illuminate\Support\Str
;
use
MongoDB\Client
;
class
Connection
extends
BaseConnection
...
...
@@ -168,9 +169,15 @@ class Connection extends BaseConnection
*/
protected
function
getDsnString
(
array
$config
)
{
$dsn
=
rawurlencode
(
$config
[
'dsn'
]);
return
"mongodb://
{
$dsn
}
"
;
$dsn_string
=
$config
[
'dsn'
];
if
(
Str
::
contains
(
$dsn_string
,
'mongodb://'
)
){
$dsn_string
=
Str
::
replaceFirst
(
'mongodb://'
,
''
,
$dsn_string
);
}
$dsn_string
=
rawurlencode
(
$dsn_string
);
return
"mongodb://
{
$dsn_string
}
"
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment