Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Netmon-SC
api-places
Commits
770f17d8
Commit
770f17d8
authored
Jun 04, 2017
by
Clemens John
Browse files
Adjust to new Namespaces
Signed-off-by:
Clemens John
<
clemens.john@floh1111.de
>
parent
d93a4a36
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Http/Controllers/CoordinatesController.php
View file @
770f17d8
...
...
@@ -2,7 +2,7 @@
namespace
Netmon\Places\Http\Controllers
;
use
Netmon
\JsonApi\Http\Controllers\DefaultResourceController
;
use
ApiServer
\JsonApi\Http\Controllers\DefaultResourceController
;
class
CoordinatesController
extends
DefaultResourceController
{
...
...
src/Models/Coordinate.php
View file @
770f17d8
...
...
@@ -2,8 +2,8 @@
namespace
Netmon\Places\Models
;
use
Netmon\
Server\
App
\Models\BaseModel
;
use
Netmon\
Server\
App
\Traits\UuidForKeyTrait
;
use
Api
Server\
Base
\Models\BaseModel
;
use
Api
Server\
Base
\Traits\UuidForKeyTrait
;
class
Coordinate
extends
BaseModel
{
...
...
@@ -99,6 +99,6 @@ class Coordinate extends BaseModel
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public
function
creator
()
{
return
$this
->
belongsTo
(
\
Netmon\
Server\
App
\Models\User
::
class
);
return
$this
->
belongsTo
(
\
Api
Server\
Users
\Models\User
::
class
);
}
}
src/Policies/CoordinatePolicy.php
View file @
770f17d8
...
...
@@ -3,9 +3,9 @@
namespace
Netmon\Places\Policies
;
use
Illuminate\Auth\Access\HandlesAuthorization
;
use
Netmon\
Server\A
pp
\Policies\BasePolicy
;
use
Api
Server\A
uthorization
\Policies\BasePolicy
;
use
Netmon\Places\Models\Coordinate
;
use
Netmon\
Server\
App
\Models\User
;
use
Api
Server\
Users
\Models\User
;
class
CoordinatePolicy
extends
BasePolicy
{
...
...
src/Providers/EventServiceProvider.php
View file @
770f17d8
...
...
@@ -5,7 +5,7 @@ namespace Netmon\Places\Providers;
use
Illuminate\Contracts\Events\Dispatcher
as
DispatcherContract
;
use
Illuminate\Foundation\Support\Providers\EventServiceProvider
as
ServiceProvider
;
use
Netmon\
Server\A
pp
\Models\Permission
;
use
Api
Server\A
uthorization
\Models\Permission
;
use
Netmon\Places\Models\Coordinate
;
class
EventServiceProvider
extends
ServiceProvider
...
...
src/Providers/RelationsServiceProvider.php
View file @
770f17d8
...
...
@@ -13,26 +13,20 @@ class RelationsServiceProvider extends ServiceProvider
*/
public
function
boot
()
{
config
([
'runtimeRelations.models.'
.
\
Netmon\Server\App\Models\User
::
class
=>
[
'createdCoordinates'
=>
[
'type'
=>
'hasMany'
,
'model'
=>
\
Netmon\Places\Models\Coordinate
::
class
,
'foreignKey'
=>
'creator_id'
,
'localKey'
=>
null
]
]
]);
add_model_relation
(
'ApiServer\Users\Models\User'
,
'createdCoordinates'
,
function
(
$model
)
{
return
$model
->
hasMany
(
'Netmon\Places\Models\Coordinate'
,
'creator_id'
);
}
);
config
([
'runtimeRelations.serializers.'
.
\
Netmon\Server\App\Serializers\UserSerializer
::
class
=>
[
'createdCoordinates'
=>
[
'type'
=>
'hasMany'
,
'serializer'
=>
\
Netmon\Paces\Serializers\CoortinateSerializer
::
class
]
]
]);
parent
::
boot
();
add_serializer_relation
(
'ApiServer\Users\Serializers\UserSerializer'
,
'createdCoordinates'
,
function
(
$serializer
,
$model
)
{
return
$serializer
->
hasMany
(
$model
,
'Netmon\Places\Serializers\CoordinateSerializer'
);
}
);
}
}
src/Serializers/CoordinateSerializer.php
View file @
770f17d8
...
...
@@ -4,11 +4,11 @@ namespace Netmon\Places\Serializers;
use
Gate
;
use
Netmon
\JsonApi\Serializers\Bas
ic
Serializer
;
use
ApiServer
\JsonApi\Serializers\Bas
e
Serializer
;
use
Netmon\Places\Models\Coordinate
;
class
CoordinateSerializer
extends
Bas
ic
Serializer
class
CoordinateSerializer
extends
Bas
e
Serializer
{
protected
$type
=
'coordinates'
;
...
...
@@ -50,7 +50,7 @@ class CoordinateSerializer extends BasicSerializer
*/
protected
function
creator
(
$model
)
{
return
$this
->
hasOne
(
$model
,
\
Netmon\
Server\
App
\Serializers\UserSerializer
::
class
);
return
$this
->
hasOne
(
$model
,
\
Api
Server\
Users
\Serializers\UserSerializer
::
class
);
}
}
...
...
src/database/migrations/2017_02_09_190100_create_coordinate_permissions.php
View file @
770f17d8
...
...
@@ -2,9 +2,9 @@
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
use
Netmon\
Server\A
pp
\Models\Role
;
use
Netmon\
Server\A
pp
\Models\Permission
;
use
Netmon\Server\App
\Models\Config
;
use
Api
Server\A
uthorization
\Models\Role
;
use
Api
Server\A
uthorization
\Models\Permission
;
use
ApiServer\Configs
\Models\Config
;
class
CreateCoordinatePermissions
extends
Migration
{
...
...
Write
Preview
Supports
Markdown
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