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
13859bb5
Commit
13859bb5
authored
May 09, 2015
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add styleci
parent
52145b0c
Show whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
2700 additions
and
2687 deletions
+2700
-2687
.styleci.yml
.styleci.yml
+16
-0
Model.php
src/Jenssegers/Eloquent/Model.php
+22
-22
DatabaseTokenRepository.php
src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
+32
-32
PasswordResetServiceProvider.php
src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php
+19
-19
Collection.php
src/Jenssegers/Mongodb/Collection.php
+3
-3
Connection.php
src/Jenssegers/Mongodb/Connection.php
+5
-5
Builder.php
src/Jenssegers/Mongodb/Eloquent/Builder.php
+20
-20
Collection.php
src/Jenssegers/Mongodb/Eloquent/Collection.php
+1
-1
SoftDeletes.php
src/Jenssegers/Mongodb/Eloquent/SoftDeletes.php
+10
-10
Model.php
src/Jenssegers/Mongodb/Model.php
+8
-5
MongodbServiceProvider.php
src/Jenssegers/Mongodb/MongodbServiceProvider.php
+35
-37
Builder.php
src/Jenssegers/Mongodb/Query/Builder.php
+32
-28
Processor.php
src/Jenssegers/Mongodb/Query/Processor.php
+0
-1
BelongsTo.php
src/Jenssegers/Mongodb/Relations/BelongsTo.php
+29
-29
BelongsToMany.php
src/Jenssegers/Mongodb/Relations/BelongsToMany.php
+279
-279
EmbedsMany.php
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
+1
-1
EmbedsOne.php
src/Jenssegers/Mongodb/Relations/EmbedsOne.php
+0
-2
EmbedsOneOrMany.php
src/Jenssegers/Mongodb/Relations/EmbedsOneOrMany.php
+6
-6
HasMany.php
src/Jenssegers/Mongodb/Relations/HasMany.php
+0
-1
HasOne.php
src/Jenssegers/Mongodb/Relations/HasOne.php
+0
-1
MorphTo.php
src/Jenssegers/Mongodb/Relations/MorphTo.php
+15
-16
Blueprint.php
src/Jenssegers/Mongodb/Schema/Blueprint.php
+227
-227
Builder.php
src/Jenssegers/Mongodb/Schema/Builder.php
+105
-106
AuthTest.php
tests/AuthTest.php
+10
-10
ConnectionTest.php
tests/ConnectionTest.php
+127
-127
ModelTest.php
tests/ModelTest.php
+483
-483
QueryBuilderTest.php
tests/QueryBuilderTest.php
+638
-638
QueryTest.php
tests/QueryTest.php
+305
-305
RelationsTest.php
tests/RelationsTest.php
+8
-8
SchemaTest.php
tests/SchemaTest.php
+182
-182
SeederTest.php
tests/SeederTest.php
+17
-17
database.php
tests/config/database.php
+18
-18
Book.php
tests/models/Book.php
+3
-3
Client.php
tests/models/Client.php
+7
-7
Group.php
tests/models/Group.php
+6
-6
Item.php
tests/models/Item.php
+4
-4
MysqlBook.php
tests/models/MysqlBook.php
+5
-5
MysqlRole.php
tests/models/MysqlRole.php
+6
-6
MysqlUser.php
tests/models/MysqlUser.php
+3
-3
Photo.php
tests/models/Photo.php
+2
-2
Role.php
tests/models/Role.php
+4
-4
User.php
tests/models/User.php
+7
-8
No files found.
.styleci.yml
0 → 100644
View file @
13859bb5
preset
:
psr2
enabled
:
-
duplicate_semicolon
-
empty_return
-
extra_empty_lines
-
operators_spaces
-
phpdoc_indent
-
remove_leading_slash_use
-
spaces_cast
-
ternary_spaces
-
unused_use
disabled
:
-
braces
-
parenthesis
src/Jenssegers/Eloquent/Model.php
View file @
13859bb5
src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
View file @
13859bb5
src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php
View file @
13859bb5
...
...
@@ -11,7 +11,7 @@ class PasswordResetServiceProvider extends \Illuminate\Auth\Passwords\PasswordRe
*/
protected
function
registerTokenRepository
()
{
$this
->
app
->
singleton
(
'auth.password.tokens'
,
function
(
$app
)
$this
->
app
->
singleton
(
'auth.password.tokens'
,
function
(
$app
)
{
$connection
=
$app
[
'db'
]
->
connection
();
...
...
src/Jenssegers/Mongodb/Collection.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb
;
use
Exception
,
MongoCollection
;
use
Jenssegers\Mongodb\Conn
ection
;
use
Exception
;
use
MongoColl
ection
;
class
Collection
{
...
...
@@ -63,7 +63,7 @@ class Collection {
}
}
$queryString
=
$this
->
collection
->
getName
()
.
'.'
.
$method
.
'('
.
join
(
','
,
$query
)
.
')'
;
$queryString
=
$this
->
collection
->
getName
()
.
'.'
.
$method
.
'('
.
implode
(
','
,
$query
)
.
')'
;
$this
->
connection
->
logQuery
(
$queryString
,
[],
$time
);
}
...
...
src/Jenssegers/Mongodb/Connection.php
View file @
13859bb5
...
...
@@ -111,7 +111,7 @@ class Connection extends \Illuminate\Database\Connection {
}
/**
* return MongoClient object
* return MongoClient object
.
*
* @return MongoClient
*/
...
...
src/Jenssegers/Mongodb/Eloquent/Builder.php
View file @
13859bb5
...
...
@@ -13,7 +13,7 @@ class Builder extends EloquentBuilder {
*/
protected
$passthru
=
array
(
'toSql'
,
'lists'
,
'insert'
,
'insertGetId'
,
'pluck'
,
'count'
,
'min'
,
'max'
,
'avg'
,
'sum'
,
'exists'
,
'push'
,
'pull'
'count'
,
'min'
,
'max'
,
'avg'
,
'sum'
,
'exists'
,
'push'
,
'pull'
,
);
/**
...
...
@@ -174,7 +174,7 @@ class Builder extends EloquentBuilder {
$relationCount
=
array_count_values
(
$query
->
lists
(
$relation
->
getHasCompareKey
()));
// Remove unwanted related objects based on the operator and count.
$relationCount
=
array_filter
(
$relationCount
,
function
(
$counted
)
use
(
$count
,
$operator
)
$relationCount
=
array_filter
(
$relationCount
,
function
(
$counted
)
use
(
$count
,
$operator
)
{
// If we are comparing to 0, we always need all results.
if
(
$count
==
0
)
return
true
;
...
...
@@ -226,7 +226,7 @@ class Builder extends EloquentBuilder {
}
// The result is a single object.
else
if
(
is_array
(
$results
)
and
array_key_exists
(
'_id'
,
$results
))
else
if
(
is_array
(
$results
)
and
array_key_exists
(
'_id'
,
$results
))
{
$model
=
$this
->
model
->
newFromBuilder
(
$results
);
...
...
src/Jenssegers/Mongodb/Eloquent/Collection.php
View file @
13859bb5
...
...
@@ -40,7 +40,7 @@ class Collection extends EloquentCollection {
list
(
$value
,
$operator
)
=
array
(
$operator
,
'='
);
}
return
$this
->
filter
(
function
(
$item
)
use
(
$key
,
$operator
,
$value
)
return
$this
->
filter
(
function
(
$item
)
use
(
$key
,
$operator
,
$value
)
{
$actual
=
$item
->
{
$key
};
...
...
src/Jenssegers/Mongodb/Eloquent/SoftDeletes.php
View file @
13859bb5
src/Jenssegers/Mongodb/Model.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb
;
use
DateTime
,
MongoId
,
MongoDate
,
Carbon\Carbon
;
use
DateTime
;
use
MongoId
;
use
MongoDate
;
use
Carbon\Carbon
;
use
Illuminate\Database\Eloquent\Relations\Relation
;
use
Jenssegers\Mongodb\DatabaseManager
as
Resolver
;
use
Jenssegers\Mongodb\Eloquent\Builder
;
use
Jenssegers\Mongodb\Relations\EmbedsOneOrMany
;
use
Jenssegers\Mongodb\Relations\EmbedsMany
;
...
...
@@ -66,7 +68,6 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
return
$this
->
getKeyName
();
}
/**
* Define an embedded one-to-many relationship.
*
...
...
@@ -306,7 +307,9 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
$value
=
$this
->
fromDateTime
(
$value
);
}
array_set
(
$this
->
attributes
,
$key
,
$value
);
return
;
array_set
(
$this
->
attributes
,
$key
,
$value
);
return
;
}
parent
::
setAttribute
(
$key
,
$value
);
...
...
src/Jenssegers/Mongodb/MongodbServiceProvider.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb
;
use
Jenssegers\Mongodb\Model
;
use
Jenssegers\Mongodb\DatabaseManager
;
use
Illuminate\Support\ServiceProvider
;
class
MongodbServiceProvider
extends
ServiceProvider
{
...
...
@@ -25,9 +23,9 @@ class MongodbServiceProvider extends ServiceProvider {
*/
public
function
register
()
{
$this
->
app
->
resolving
(
'db'
,
function
(
$db
)
$this
->
app
->
resolving
(
'db'
,
function
(
$db
)
{
$db
->
extend
(
'mongodb'
,
function
(
$config
)
$db
->
extend
(
'mongodb'
,
function
(
$config
)
{
return
new
Connection
(
$config
);
});
...
...
src/Jenssegers/Mongodb/Query/Builder.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb\Query
;
use
MongoId
,
MongoRegex
,
MongoDate
,
DateTime
,
Closure
;
use
MongoId
;
use
MongoRegex
;
use
MongoDate
;
use
DateTime
;
use
Closure
;
use
Illuminate\Database\Query\Builder
as
BaseBuilder
;
use
Illuminate\Database\Query\Expression
;
use
Illuminate\Support\Collection
;
...
...
@@ -9,7 +13,7 @@ use Jenssegers\Mongodb\Connection;
class
Builder
extends
BaseBuilder
{
/**
* The database collection
* The database collection
.
*
* @var MongoCollection
*/
...
...
@@ -248,7 +252,7 @@ class Builder extends BaseBuilder {
}
// Distinct query
else
if
(
$this
->
distinct
)
elseif
(
$this
->
distinct
)
{
// Return distinct results directly
$column
=
isset
(
$this
->
columns
[
0
])
?
$this
->
columns
[
0
]
:
'_id'
;
...
...
@@ -507,7 +511,7 @@ class Builder extends BaseBuilder {
}
// Protect
$this
->
where
(
function
(
$query
)
use
(
$column
)
$this
->
where
(
function
(
$query
)
use
(
$column
)
{
$query
->
where
(
$column
,
'exists'
,
false
);
...
...
@@ -612,7 +616,7 @@ class Builder extends BaseBuilder {
$results
=
new
Collection
(
$this
->
get
([
$column
,
$key
]));
// Convert MongoId's to strings so that lists can do its work.
$results
=
$results
->
map
(
function
(
$item
)
$results
=
$results
->
map
(
function
(
$item
)
{
$item
[
'_id'
]
=
(
string
)
$item
[
'_id'
];
...
...
@@ -640,7 +644,7 @@ class Builder extends BaseBuilder {
}
// Create an expression for the given value
else
if
(
!
is_null
(
$expression
))
elseif
(
!
is_null
(
$expression
))
{
return
new
Expression
(
$expression
);
}
...
...
@@ -668,7 +672,7 @@ class Builder extends BaseBuilder {
{
$query
=
array
(
$operator
=>
$column
);
}
else
if
(
$batch
)
elseif
(
$batch
)
{
$query
=
array
(
$operator
=>
array
(
$column
=>
array
(
'$each'
=>
$value
)));
}
...
...
@@ -862,7 +866,7 @@ class Builder extends BaseBuilder {
}
// Single value.
else
if
(
isset
(
$where
[
'value'
]))
elseif
(
isset
(
$where
[
'value'
]))
{
$where
[
'value'
]
=
$this
->
convertKey
(
$where
[
'value'
]);
}
...
...
@@ -879,7 +883,7 @@ class Builder extends BaseBuilder {
// use the operator of the next where.
if
(
$i
==
0
and
count
(
$wheres
)
>
1
and
$where
[
'boolean'
]
==
'and'
)
{
$where
[
'boolean'
]
=
$wheres
[
$i
+
1
][
'boolean'
];
$where
[
'boolean'
]
=
$wheres
[
$i
+
1
][
'boolean'
];
}
// We use different methods to compile different wheres.
...
...
@@ -894,7 +898,7 @@ class Builder extends BaseBuilder {
// If there are multiple wheres, we will wrap it with $and. This is needed
// to make nested wheres work.
else
if
(
count
(
$wheres
)
>
1
)
elseif
(
count
(
$wheres
)
>
1
)
{
$result
=
array
(
'$and'
=>
array
(
$result
));
}
...
...
@@ -944,7 +948,7 @@ class Builder extends BaseBuilder {
{
$query
=
array
(
$column
=>
$value
);
}
else
if
(
array_key_exists
(
$operator
,
$this
->
conversion
))
elseif
(
array_key_exists
(
$operator
,
$this
->
conversion
))
{
$query
=
array
(
$column
=>
array
(
$this
->
conversion
[
$operator
]
=>
$value
));
}
...
...
@@ -1003,15 +1007,15 @@ class Builder extends BaseBuilder {
'$or'
=>
array
(
array
(
$column
=>
array
(
'$lte'
=>
$values
[
0
]
)
'$lte'
=>
$values
[
0
]
,
)
,
),
array
(
$column
=>
array
(
'$gte'
=>
$values
[
1
]
)
)
)
'$gte'
=>
$values
[
1
]
,
)
,
)
,
)
,
);
}
else
...
...
@@ -1019,8 +1023,8 @@ class Builder extends BaseBuilder {
return
array
(
$column
=>
array
(
'$gte'
=>
$values
[
0
],
'$lte'
=>
$values
[
1
]
)
'$lte'
=>
$values
[
1
]
,
)
,
);
}
}
...
...
src/Jenssegers/Mongodb/Query/Processor.php
View file @
13859bb5
...
...
@@ -4,5 +4,4 @@ use Illuminate\Database\Query\Processors\Processor as BaseProcessor;
class
Processor
extends
BaseProcessor
{
}
src/Jenssegers/Mongodb/Relations/BelongsTo.php
View file @
13859bb5
src/Jenssegers/Mongodb/Relations/BelongsToMany.php
View file @
13859bb5
...
...
@@ -101,7 +101,7 @@ class BelongsToMany extends EloquentBelongsToMany {
public
function
sync
(
$ids
,
$detaching
=
true
)
{
$changes
=
array
(
'attached'
=>
array
(),
'detached'
=>
array
(),
'updated'
=>
array
()
'attached'
=>
array
(),
'detached'
=>
array
(),
'updated'
=>
array
(),
);
if
(
$ids
instanceof
Collection
)
$ids
=
$ids
->
modelKeys
();
...
...
@@ -129,7 +129,7 @@ class BelongsToMany extends EloquentBelongsToMany {
{
$this
->
detach
(
$detach
);
$changes
[
'detached'
]
=
(
array
)
array_map
(
function
(
$v
)
{
return
(
int
)
$v
;
},
$detach
);
$changes
[
'detached'
]
=
(
array
)
array_map
(
function
(
$v
)
{
return
(
int
)
$v
;
},
$detach
);
}
// Now we are finally ready to attach the new records. Note that we'll disable
...
...
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
View file @
13859bb5
...
...
@@ -286,7 +286,7 @@ class EmbedsMany extends EmbedsOneOrMany {
$sliced
=
array_slice
(
$results
,
$start
,
$perPage
);
return
new
LengthAwarePaginator
(
$sliced
,
$total
,
$perPage
,
$page
,
[
'path'
=>
Paginator
::
resolveCurrentPath
()
'path'
=>
Paginator
::
resolveCurrentPath
()
,
]);
}
...
...
src/Jenssegers/Mongodb/Relations/EmbedsOne.php
View file @
13859bb5
...
...
@@ -2,8 +2,6 @@
use
MongoId
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Builder
;
use
Illuminate\Database\Eloquent\Relations\Relation
;
class
EmbedsOne
extends
EmbedsOneOrMany
{
...
...
src/Jenssegers/Mongodb/Relations/EmbedsOneOrMany.php
View file @
13859bb5
...
...
@@ -208,7 +208,7 @@ abstract class EmbedsOneOrMany extends Relation {
}
/**
* Transform single ID, single Model or array of Models into an array of IDs
* Transform single ID, single Model or array of Models into an array of IDs
.
*
* @param mixed $ids
* @return array
...
...
@@ -305,7 +305,7 @@ abstract class EmbedsOneOrMany extends Relation {
*/
protected
function
toModel
(
$attributes
=
array
())
{
if
(
is_null
(
$attributes
))
return
null
;
if
(
is_null
(
$attributes
))
return
;
$model
=
$this
->
related
->
newFromBuilder
((
array
)
$attributes
);
...
...
src/Jenssegers/Mongodb/Relations/HasMany.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb\Relations
;
use
Illuminate\Database\Eloquent\Builder
;
use
Illuminate\Database\Eloquent\Collection
;
use
Illuminate\Database\Eloquent\Relations\HasMany
as
EloquentHasMany
;
class
HasMany
extends
EloquentHasMany
{
...
...
src/Jenssegers/Mongodb/Relations/HasOne.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb\Relations
;
use
Illuminate\Database\Eloquent\Builder
;
use
Illuminate\Database\Eloquent\Collection
;
use
Illuminate\Database\Eloquent\Relations\HasOne
as
EloquentHasOne
;
class
HasOne
extends
EloquentHasOne
{
...
...
src/Jenssegers/Mongodb/Relations/MorphTo.php
View file @
13859bb5
<?php
namespace
Jenssegers\Mongodb\Relations
;
use
Illuminate\Database\Eloquent\Collection
;
use
Illuminate\Database\Eloquent\Relations\MorphTo
as
EloquentMorphTo
;
class
MorphTo
extends
EloquentMorphTo
{
...
...
src/Jenssegers/Mongodb/Schema/Blueprint.php
View file @
13859bb5
...
...
@@ -20,7 +20,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
protected
$collection
;
/**
* Fluent columns
* Fluent columns.
*
* @var array
*/
...
...
@@ -201,7 +201,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
}
/**
* Allow fluent columns
* Allow fluent columns.
*
* @param string|array $columns
* @return string|array
...
...
@@ -212,7 +212,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
{
return
$this
->
columns
;
}
else
if
(
is_string
(
$columns
))
else
if
(
is_string
(
$columns
))
{
return
$this
->
columns
=
array
(
$columns
);
}
...
...
src/Jenssegers/Mongodb/Schema/Builder.php
View file @
13859bb5
...
...
@@ -2,7 +2,6 @@
use
Closure
;
use
Jenssegers\Mongodb\Connection
;
use
Jenssegers\Mongodb\Schema\Blueprint
;
class
Builder
extends
\Illuminate\Database\Schema\Builder
{
...
...
tests/AuthTest.php
View file @
13859bb5
...
...
@@ -15,7 +15,7 @@ class AuthTest extends TestCase {
$user
=
User
::
create
([
'name'
=>
'John Doe'
,
'email'
=>
'john@doe.com'
,
'password'
=>
Hash
::
make
(
'foobar'
)
'password'
=>
Hash
::
make
(
'foobar'
)
,
]);
$this
->
assertTrue
(
Auth
::
attempt
([
'email'
=>
'john@doe.com'
,
'password'
=>
'foobar'
],
true
));
...
...
@@ -33,7 +33,7 @@ class AuthTest extends TestCase {
$user
=
User
::
create
([
'name'
=>
'John Doe'
,
'email'
=>
'john@doe.com'
,
'password'
=>
Hash
::
make
(
'foobar'
)
'password'
=>
Hash
::
make
(
'foobar'
)
,
]);
$mailer
->
shouldReceive
(
'send'
)
->
once
();
...
...
@@ -49,10 +49,10 @@ class AuthTest extends TestCase {
'email'
=>
'john@doe.com'
,
'password'
=>
'foobar'
,
'password_confirmation'
=>
'foobar'
,
'token'
=>
$reminder
[
'token'
]
'token'
=>
$reminder
[
'token'
],
];
$response
=
$broker
->
reset
(
$credentials
,
function
(
$user
,
$password
)
$response
=
$broker
->
reset
(
$credentials
,
function
(
$user
,
$password
)
{
$user
->
password
=
bcrypt
(
$password
);
$user
->
save
();
...
...
tests/ConnectionTest.php
View file @
13859bb5
tests/ModelTest.php
View file @
13859bb5
...
...
@@ -182,7 +182,7 @@ class ModelTest extends TestCase {
{
User
::
insert
([
[
'name'
=>
'John Doe'
],
[
'name'
=>
'Jane Doe'
]
[
'name'
=>
'Jane Doe'
],
]);
$users
=
User
::
get
();
...
...
@@ -195,7 +195,7 @@ class ModelTest extends TestCase {
{
User
::
insert
([
[
'name'
=>
'John Doe'
],
[
'name'
=>
'Jane Doe'
]
[
'name'
=>
'Jane Doe'
],
]);
$user
=
User
::
first
();
...
...
@@ -209,7 +209,7 @@ class ModelTest extends TestCase {
$this
->
assertInstanceOf
(
'Illuminate\Database\Eloquent\Collection'
,
$items
);
$this
->
assertEquals
(
0
,
$items
->
count
());
$item
=
Item
::
where
(
'name'
,
'nothing'
)
->
first
();
$item
=
Item
::
where
(
'name'
,
'nothing'
)
->
first
();
$this
->
assertEquals
(
null
,
$item
);
$item
=
Item
::
find
(
'51c33d8981fec6813e00000a'
);
...
...
@@ -319,7 +319,7 @@ class ModelTest extends TestCase {
{
Item
::
insert
([
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
]
[
'name'
=>
'spoon'
,
'type'
=>
'round'
],
]);
$sharp
=
Item
::
sharp
()
->
get
();
...
...
@@ -445,26 +445,26 @@ class ModelTest extends TestCase {
User
::
create
([
'name'
=>
'Jane Doe'
,
'age'
=>
35
]);
User
::
create
([
'name'
=>
'Harry Hoe'
,
'age'
=>
15
]);
$users
=
User
::
raw
(
function
(
$collection
)
$users
=
User
::
raw
(
function
(
$collection
)
{
return
$collection
->
find
([
'age'
=>
35
]);
});
$this
->
assertInstanceOf
(
'Illuminate\Database\Eloquent\Collection'
,
$users
);
$this
->
assertInstanceOf
(
'Jenssegers\Mongodb\Model'
,
$users
[
0
]);
$user
=
User
::
raw
(
function
(
$collection
)
$user
=
User
::
raw
(
function
(
$collection
)
{
return
$collection
->
findOne
([
'age'
=>
35
]);
});
$this
->
assertInstanceOf
(
'Jenssegers\Mongodb\Model'
,
$user
);
$count
=
User
::
raw
(
function
(
$collection
)
$count
=
User
::
raw
(
function
(
$collection
)
{
return
$collection
->
count
();
});
$this
->
assertEquals
(
3
,
$count
);
$result
=
User
::
raw
(
function
(
$collection
)
$result
=
User
::
raw
(
function
(
$collection
)
{
return
$collection
->
insert
([
'name'
=>
'Yvonne Yoe'
,
'age'
=>
35
]);
});
...
...
@@ -478,7 +478,7 @@ class ModelTest extends TestCase {
'address'
=>
[
'city'
=>
'Paris'
,
'country'
=>
'France'
,
]
],
]);
$this
->
assertEquals
(
'Paris'
,
$user
->
getAttribute
(
'address.city'
));
...
...
tests/QueryBuilderTest.php
View file @
13859bb5
...
...
@@ -93,7 +93,7 @@ class QueryBuilderTest extends TestCase {
{
DB
::
collection
(
'users'
)
->
insert
([
[
'name'
=>
'Jane Doe'
],
[
'name'
=>
'John Doe'
]
[
'name'
=>
'John Doe'
],
]);
$this
->
assertEquals
(
2
,
DB
::
collection
(
'users'
)
->
count
());
...
...
@@ -103,7 +103,7 @@ class QueryBuilderTest extends TestCase {
{
DB
::
collection
(
'users'
)
->
insert
([
[
'name'
=>
'Jane Doe'
,
'age'
=>
20
],
[
'name'
=>
'John Doe'
,
'age'
=>
21
]
[
'name'
=>
'John Doe'
,
'age'
=>
21
],
]);
DB
::
collection
(
'users'
)
->
where
(
'name'
,
'John Doe'
)
->
update
([
'age'
=>
100
]);
...
...
@@ -119,7 +119,7 @@ class QueryBuilderTest extends TestCase {
{
DB
::
collection
(
'users'
)
->
insert
([
[
'name'
=>
'Jane Doe'
,
'age'
=>
20
],
[
'name'
=>
'John Doe'
,
'age'
=>
25
]
[
'name'
=>
'John Doe'
,
'age'
=>
25
],
]);
DB
::
collection
(
'users'
)
->
where
(
'age'
,
'<'
,
10
)
->
delete
();
...
...
@@ -141,12 +141,12 @@ class QueryBuilderTest extends TestCase {
DB
::
collection
(
'users'
)
->
insert
([
[
'name'
=>
'John Doe'
,
'address'
=>
[
'country'
=>
'Belgium'
,
'city'
=>
'Ghent'
]
'address'
=>
[
'country'
=>
'Belgium'
,
'city'
=>
'Ghent'
],
],
[
'name'
=>
'Jane Doe'
,
'address'
=>
[
'country'
=>
'France'
,
'city'
=>
'Paris'
]
]
'address'
=>
[
'country'
=>
'France'
,
'city'
=>
'Paris'
],
],
]);
$users
=
DB
::
collection
(
'users'
)
->
where
(
'address.country'
,
'Belgium'
)
->
get
();
...
...
@@ -158,11 +158,11 @@ class QueryBuilderTest extends TestCase {
{
DB
::
collection
(
'items'
)
->
insert
([
[
'tags'
=>
[
'tag1'
,
'tag2'
,
'tag3'
,
'tag4'
]
'tags'
=>
[
'tag1'
,
'tag2'
,
'tag3'
,
'tag4'
],
],
[
'tags'
=>
[
'tag2'
]
]
'tags'
=>
[
'tag2'
],
],
]);
$items
=
DB
::
collection
(
'items'
)
->
where
(
'tags'
,
'tag2'
)
->
get
();
...
...
@@ -176,10 +176,10 @@ class QueryBuilderTest extends TestCase {
{
DB
::
collection
(
'users'
)
->
insert
([
[
'name'
=>
'Jane Doe'
,
'age'
=>
20
],
[
'name'
=>
'John Doe'
,
'age'
=>
25
]
[
'name'
=>
'John Doe'
,
'age'
=>
25
],
]);
$cursor
=
DB
::
collection
(
'users'
)
->
raw
(
function
(
$collection
)
$cursor
=
DB
::
collection
(
'users'
)
->
raw
(
function
(
$collection
)
{
return
$collection
->
find
([
'age'
=>
20
]);
});
...
...
@@ -254,7 +254,7 @@ class QueryBuilderTest extends TestCase {
$id
=
DB
::
collection
(
'users'
)
->
insertGetId
([
'name'
=>
'John Doe'
,
'tags'
=>
[
'tag1'
,
'tag2'
,
'tag3'
,
'tag4'
],
'messages'
=>
[
$message1
,
$message2
]
'messages'
=>
[
$message1
,
$message2
],
]);
DB
::
collection
(
'users'
)
->
where
(
'_id'
,
$id
)
->
pull
(
'tags'
,
'tag3'
);
...
...
@@ -280,10 +280,10 @@ class QueryBuilderTest extends TestCase {
public
function
testDistinct
()
{
DB
::
collection
(
'items'
)
->
insert
([
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
,
],
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
],
[
'name'
=>
'fork'
,
'type'
=>
'sharp'
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
]
[
'name'
=>
'spoon'
,
'type'
=>
'round'
],
]);
$items
=
DB
::
collection
(
'items'
)
->
distinct
(
'name'
)
->
get
();
sort
(
$items
);
...
...
@@ -300,7 +300,7 @@ class QueryBuilderTest extends TestCase {
DB
::
collection
(
'items'
)
->
insert
([
[
'_id'
=>
'knife'
,
'type'
=>
'sharp'
,
'amount'
=>
34
],
[
'_id'
=>
'fork'
,
'type'
=>
'sharp'
,
'amount'
=>
20
],
[
'_id'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
]
[
'_id'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
],
]);
$item
=
DB
::
collection
(
'items'
)
->
find
(
'knife'
);
...
...
@@ -311,7 +311,7 @@ class QueryBuilderTest extends TestCase {
DB
::
collection
(
'users'
)
->
insert
([
[
'_id'
=>
1
,
'name'
=>
'Jane Doe'
],
[
'_id'
=>
2
,
'name'
=>
'John Doe'
]
[
'_id'
=>
2
,
'name'
=>
'John Doe'
],
]);
$item
=
DB
::
collection
(
'users'
)
->
find
(
1
);
...
...
@@ -324,7 +324,7 @@ class QueryBuilderTest extends TestCase {
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
,
'amount'
=>
34
],
[
'name'
=>
'fork'
,
'type'
=>
'sharp'
,
'amount'
=>
20
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
]
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
],
]);
$items
=
DB
::
collection
(
'items'
)
->
orderBy
(
'name'
)
->
take
(
2
)
->
get
();
...
...
@@ -338,7 +338,7 @@ class QueryBuilderTest extends TestCase {
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
,
'amount'
=>
34
],
[
'name'
=>
'fork'
,
'type'
=>
'sharp'
,
'amount'
=>
20
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
]
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
],
]);
$items
=
DB
::
collection
(
'items'
)
->
orderBy
(
'name'
)
->
skip
(
2
)
->
get
();
...
...
@@ -350,7 +350,7 @@ class QueryBuilderTest extends TestCase {
{
DB
::
collection
(
'users'
)
->
insert
([
[
'name'
=>
'Jane Doe'
,
'age'
=>
20
],
[
'name'
=>
'John Doe'
,
'age'
=>
25
]
[
'name'
=>
'John Doe'
,
'age'
=>
25
],
]);
$age
=
DB
::
collection
(
'users'
)
->
where
(
'name'
,
'John Doe'
)
->
pluck
(
'age'
);
...
...
@@ -363,7 +363,7 @@ class QueryBuilderTest extends TestCase {
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
,
'amount'
=>
34
],
[
'name'
=>
'fork'
,
'type'
=>
'sharp'
,
'amount'
=>
20
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
]
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
],
]);
$list
=
DB
::
collection
(
'items'
)
->
lists
(
'name'
);
...
...
@@ -386,7 +386,7 @@ class QueryBuilderTest extends TestCase {
[
'name'
=>
'knife'
,
'type'
=>
'sharp'
,
'amount'
=>
34
],
[
'name'
=>
'fork'
,
'type'
=>
'sharp'
,
'amount'
=>
20
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
3
],
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
]
[
'name'
=>
'spoon'
,
'type'
=>
'round'
,
'amount'
=>
14
],
]);
$this
->
assertEquals
(
71
,
DB
::
collection
(
'items'
)
->
sum
(
'amount'
));
...
...
@@ -405,7 +405,7 @@ class QueryBuilderTest extends TestCase {
[
'name'
=>
'knife'
,
'amount'
=>
[
'hidden'
=>
10
,
'found'
=>
3
]],
[
'name'
=>
'fork'
,
'amount'
=>
[
'hidden'
=>
35
,
'found'
=>
12
]],
[
'name'
=>
'spoon'
,
'amount'
=>
[
'hidden'
=>
14
,
'found'
=>
21
]],
[
'name'
=>
'spoon'
,
'amount'
=>
[
'hidden'
=>
6
,
'found'
=>
4
]]
[
'name'
=>
'spoon'
,
'amount'
=>
[
'hidden'
=>
6
,
'found'
=>
4
]],
]);
$this
->
assertEquals
(
65
,
DB
::
collection
(
'items'
)
->
sum
(
'amount.hidden'
));
...
...
@@ -559,16 +559,16 @@ class QueryBuilderTest extends TestCase {
'name'
=>
'John Doe'
,
'addresses'
=>
[
[
'city'
=>
'Ghent'
],
[
'city'
=>
'Paris'
]
]
[
'city'
=>
'Paris'
],
],
],
[
'name'
=>
'Jane Doe'
,
'addresses'
=>
[
[
'city'
=>
'Brussels'
],
[
'city'
=>
'Paris'
]
]
]
[
'city'
=>
'Paris'
],
],
],
]);
$users
=
DB
::
collection
(
'users'
)
->
where
(
'addresses'
,
'elemMatch'
,
[
'city'
=>
'Brussels'
])
->
get
();
...
...
tests/QueryTest.php
View file @
13859bb5
...
...
@@ -208,7 +208,7 @@ class QueryTest extends TestCase {
public
function
testSubquery
()
{
$users
=
User
::
where
(
'title'
,
'admin'
)
->
orWhere
(
function
(
$query
)
$users
=
User
::
where
(
'title'
,
'admin'
)
->
orWhere
(
function
(
$query
)
{
$query
->
where
(
'name'
,
'Tommy Toe'
)
->
orWhere
(
'name'
,
'Error'
);
...
...
@@ -217,7 +217,7 @@ class QueryTest extends TestCase {
$this
->
assertEquals
(
5
,
count
(
$users
));
$users
=
User
::
where
(
'title'
,
'user'
)
->
where
(
function
(
$query
)
$users
=
User
::
where
(
'title'
,
'user'
)
->
where
(
function
(
$query
)
{
$query
->
where
(
'age'
,
35
)
->
orWhere
(
'name'
,
'like'
,
'%harry%'
);
...
...
@@ -226,7 +226,7 @@ class QueryTest extends TestCase {
$this
->
assertEquals
(
2
,
count
(
$users
));
$users
=
User
::
where
(
'age'
,
35
)
->
orWhere
(
function
(
$query
)
$users
=
User
::
where
(
'age'
,
35
)
->
orWhere
(
function
(
$query
)
{
$query
->
where
(
'title'
,
'admin'
)
->
orWhere
(
'name'
,
'Error'
);
...
...
@@ -237,7 +237,7 @@ class QueryTest extends TestCase {
$users
=
User
::
whereNull
(
'deleted_at'
)
->
where
(
'title'
,
'admin'
)
->
where
(
function
(
$query
)
->
where
(
function
(
$query
)
{
$query
->
where
(
'age'
,
'>'
,
15
)
->
orWhere
(
'name'
,
'Harry Hoe'
);
...
...
@@ -247,10 +247,10 @@ class QueryTest extends TestCase {
$this
->
assertEquals
(
3
,
$users
->
count
());
$users
=
User
::
whereNull
(
'deleted_at'
)
->
where
(
function
(
$query
)
->
where
(
function
(
$query
)
{
$query
->
where
(
'name'
,
'Harry Hoe'
)
->
orWhere
(
function
(
$query
)
->
orWhere
(
function
(
$query
)
{
$query
->
where
(
'age'
,
'>'
,
15
)
->
where
(
'title'
,
'<>'
,
'admin'
);
...
...
@@ -277,22 +277,22 @@ class QueryTest extends TestCase {
public
function
testMultipleOr
()
{
$users
=
User
::
where
(
function
(
$query
)
$users
=
User
::
where
(
function
(
$query
)
{
$query
->
where
(
'age'
,
35
)
->
orWhere
(
'age'
,
33
);
})
->
where
(
function
(
$query
)
->
where
(
function
(
$query
)
{
$query
->
where
(
'name'
,
'John Doe'
)
->
orWhere
(
'name'
,
'Jane Doe'
);
})
->
get
();
$this
->
assertEquals
(
2
,
count
(
$users
));
$users
=
User
::
where
(
function
(
$query
)
$users
=
User
::
where
(
function
(
$query
)
{
$query
->
orWhere
(
'age'
,
35
)
->
orWhere
(
'age'
,
33
);
})
->
where
(
function
(
$query
)
->
where
(
function
(
$query
)
{
$query
->
orWhere
(
'name'
,
'John Doe'
)
->
orWhere
(
'name'
,
'Jane Doe'
);
})
->
get
();
...
...
tests/RelationsTest.php
View file @
13859bb5
...
...
@@ -228,12 +228,12 @@ class RelationsTest extends TestCase {
$clients
=
[
Client
::
create
([
'name'
=>
'Pork Pies Ltd.'
])
->
_id
,
Client
::
create
([
'name'
=>
'Buffet Bar Inc.'
])
->
_id
Client
::
create
([
'name'
=>
'Buffet Bar Inc.'
])
->
_id
,
];
$moreClients
=
[
Client
::
create
([
'name'
=>
'synced Boloni Ltd.'
])
->
_id
,
Client
::
create
([
'name'
=>
'synced Meatballs Inc.'
])
->
_id
Client
::
create
([
'name'
=>
'synced Meatballs Inc.'
])
->
_id
,
];
// Sync multiple records
...
...
@@ -410,14 +410,14 @@ class RelationsTest extends TestCase {
$authors
=
User
::
has
(
'books'
,
'!='
,
0
)
->
get
();
$this
->
assertCount
(
2
,
$authors
);
$authors
=
User
::
whereHas
(
'books'
,
function
(
$query
)
$authors
=
User
::
whereHas
(
'books'
,
function
(
$query
)
{
$query
->
where
(
'rating'
,
5
);
})
->
get
();
$this
->
assertCount
(
1
,
$authors
);
$authors
=
User
::
whereHas
(
'books'
,
function
(
$query
)
$authors
=
User
::
whereHas
(
'books'
,
function
(
$query
)
{
$query
->
where
(
'rating'
,
'<'
,
5
);
...
...
@@ -451,15 +451,15 @@ class RelationsTest extends TestCase {
$client
=
Client
::
create
([
'data'
=>
[
'client_id'
=>
35298
,
'name'
=>
'John Doe'
]
'name'
=>
'John Doe'
,
]
,
]);
$address
=
$client
->
addresses
()
->
create
([
'data'
=>
[
'address_id'
=>
1432
,
'city'
=>
'Paris'
]
'city'
=>
'Paris'
,
]
,
]);
$client
=
Client
::
where
(
'data.client_id'
,
35298
)
->
first
();
...
...
tests/SchemaTest.php
View file @
13859bb5
...
...
@@ -18,7 +18,7 @@ class SchemaTest extends TestCase {
{
$instance
=
$this
;
Schema
::
create
(
'newcollection'
,
function
(
$collection
)
use
(
$instance
)
Schema
::
create
(
'newcollection'
,
function
(
$collection
)
use
(
$instance
)
{
$instance
->
assertInstanceOf
(
'Jenssegers\Mongodb\Schema\Blueprint'
,
$collection
);
});
...
...
@@ -37,12 +37,12 @@ class SchemaTest extends TestCase {
{
$instance
=
$this
;
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
use
(
$instance
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
use
(
$instance
)
{
$instance
->
assertInstanceOf
(
'Jenssegers\Mongodb\Schema\Blueprint'
,
$collection
);
});
Schema
::
table
(
'newcollection'
,
function
(
$collection
)
use
(
$instance
)
Schema
::
table
(
'newcollection'
,
function
(
$collection
)
use
(
$instance
)
{
$instance
->
assertInstanceOf
(
'Jenssegers\Mongodb\Schema\Blueprint'
,
$collection
);
});
...
...
@@ -50,7 +50,7 @@ class SchemaTest extends TestCase {
public
function
testIndex
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
index
(
'mykey'
);
});
...
...
@@ -58,7 +58,7 @@ class SchemaTest extends TestCase {
$index
=
$this
->
getIndex
(
'newcollection'
,
'mykey'
);
$this
->
assertEquals
(
1
,
$index
[
'key'
][
'mykey'
]);
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
index
([
'mykey'
]);
});
...
...
@@ -69,7 +69,7 @@ class SchemaTest extends TestCase {
public
function
testUnique
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
unique
(
'uniquekey'
);
});
...
...
@@ -80,7 +80,7 @@ class SchemaTest extends TestCase {
public
function
testDropIndex
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
unique
(
'uniquekey'
);
$collection
->
dropIndex
(
'uniquekey'
);
...
...
@@ -89,7 +89,7 @@ class SchemaTest extends TestCase {
$index
=
$this
->
getIndex
(
'newcollection'
,
'uniquekey'
);
$this
->
assertEquals
(
null
,
$index
);
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
unique
(
'uniquekey'
);
$collection
->
dropIndex
([
'uniquekey'
]);
...
...
@@ -101,7 +101,7 @@ class SchemaTest extends TestCase {
public
function
testBackground
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
background
(
'backgroundkey'
);
});
...
...
@@ -112,7 +112,7 @@ class SchemaTest extends TestCase {
public
function
testSparse
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
sparse
(
'sparsekey'
);
});
...
...
@@ -123,7 +123,7 @@ class SchemaTest extends TestCase {
public
function
testExpire
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
expire
(
'expirekey'
,
60
);
});
...
...
@@ -134,12 +134,12 @@ class SchemaTest extends TestCase {
public
function
testSoftDeletes
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
softDeletes
();
});
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
string
(
'email'
)
->
nullable
()
->
index
();
});
...
...
@@ -150,7 +150,7 @@ class SchemaTest extends TestCase {
public
function
testFluent
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
string
(
'email'
)
->
index
();
$collection
->
string
(
'token'
)
->
index
();
...
...
@@ -166,7 +166,7 @@ class SchemaTest extends TestCase {
public
function
testDummies
()
{
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
Schema
::
collection
(
'newcollection'
,
function
(
$collection
)
{
$collection
->
boolean
(
'activated'
)
->
default
(
0
);
$collection
->
integer
(
'user_id'
)
->
unsigned
();
...
...
tests/SeederTest.php
View file @
13859bb5
tests/config/database.php
View file @
13859bb5
...
...
@@ -21,6 +21,6 @@ return [
'collation'
=>
'utf8_unicode_ci'
,
'prefix'
=>
''
,
],
]
],
];
tests/models/Book.php
View file @
13859bb5
tests/models/Client.php
View file @
13859bb5
tests/models/Group.php
View file @
13859bb5
tests/models/Item.php
View file @
13859bb5
tests/models/MysqlBook.php
View file @
13859bb5
...
...
@@ -16,7 +16,7 @@ class MysqlBook extends Eloquent {
}
/**
* Check if we need to run the schema
* Check if we need to run the schema
.
* @return [type] [description]
*/
public
static
function
executeSchema
()
...
...
@@ -25,7 +25,7 @@ class MysqlBook extends Eloquent {
if
(
!
$schema
->
hasTable
(
'books'
))
{
Schema
::
connection
(
'mysql'
)
->
create
(
'books'
,
function
(
$table
)
Schema
::
connection
(
'mysql'
)
->
create
(
'books'
,
function
(
$table
)
{
$table
->
string
(
'title'
);
$table
->
string
(
'author_id'
);
...
...
tests/models/MysqlRole.php
View file @
13859bb5
...
...
@@ -20,7 +20,7 @@ class MysqlRole extends Eloquent {
}
/**
* Check if we need to run the schema
* Check if we need to run the schema
.
* @return [type] [description]
*/
public
static
function
executeSchema
()
...
...
@@ -29,7 +29,7 @@ class MysqlRole extends Eloquent {
if
(
!
$schema
->
hasTable
(
'roles'
))
{
Schema
::
connection
(
'mysql'
)
->
create
(
'roles'
,
function
(
$table
)
Schema
::
connection
(
'mysql'
)
->
create
(
'roles'
,
function
(
$table
)
{
$table
->
string
(
'type'
);
$table
->
string
(
'user_id'
);
...
...
tests/models/MysqlUser.php
View file @
13859bb5
...
...
@@ -20,7 +20,7 @@ class MysqlUser extends Eloquent {
}
/**
* Check if we need to run the schema
* Check if we need to run the schema
.
* @return [type] [description]
*/
public
static
function
executeSchema
()
...
...
@@ -29,7 +29,7 @@ class MysqlUser extends Eloquent {
if
(
!
$schema
->
hasTable
(
'users'
))
{
Schema
::
connection
(
'mysql'
)
->
create
(
'users'
,
function
(
$table
)
Schema
::
connection
(
'mysql'
)
->
create
(
'users'
,
function
(
$table
)
{
$table
->
increments
(
'id'
);
$table
->
string
(
'name'
);
...
...
tests/models/Photo.php
View file @
13859bb5
tests/models/Role.php
View file @
13859bb5
tests/models/User.php
View file @
13859bb5
<?php
use
Jenssegers\Mongodb\Model
as
Eloquent
;
use
Illuminate\Auth\Authenticatable
;
use
Illuminate\Auth\Passwords\CanResetPassword
;
use
Illuminate\Contracts\Auth\Authenticatable
as
AuthenticatableContract
;
...
...
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