Commit 770f17d8 authored by Clemens John's avatar Clemens John
Browse files

Adjust to new Namespaces


Signed-off-by: Clemens John's avatarClemens John <clemens.john@floh1111.de>
parent d93a4a36
......@@ -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
{
......
......@@ -2,8 +2,8 @@
namespace Netmon\Places\Models;
use Netmon\Server\App\Models\BaseModel;
use Netmon\Server\App\Traits\UuidForKeyTrait;
use ApiServer\Base\Models\BaseModel;
use ApiServer\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(\ApiServer\Users\Models\User::class);
}
}
......@@ -3,9 +3,9 @@
namespace Netmon\Places\Policies;
use Illuminate\Auth\Access\HandlesAuthorization;
use Netmon\Server\App\Policies\BasePolicy;
use ApiServer\Authorization\Policies\BasePolicy;
use Netmon\Places\Models\Coordinate;
use Netmon\Server\App\Models\User;
use ApiServer\Users\Models\User;
class CoordinatePolicy extends BasePolicy
{
......
......@@ -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\App\Models\Permission;
use ApiServer\Authorization\Models\Permission;
use Netmon\Places\Models\Coordinate;
class EventServiceProvider extends ServiceProvider
......
......@@ -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');
}
);
}
}
......@@ -4,11 +4,11 @@ namespace Netmon\Places\Serializers;
use Gate;
use Netmon\JsonApi\Serializers\BasicSerializer;
use ApiServer\JsonApi\Serializers\BaseSerializer;
use Netmon\Places\Models\Coordinate;
class CoordinateSerializer extends BasicSerializer
class CoordinateSerializer extends BaseSerializer
{
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, \ApiServer\Users\Serializers\UserSerializer::class);
}
}
......
......@@ -2,9 +2,9 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Netmon\Server\App\Models\Role;
use Netmon\Server\App\Models\Permission;
use Netmon\Server\App\Models\Config;
use ApiServer\Authorization\Models\Role;
use ApiServer\Authorization\Models\Permission;
use ApiServer\Configs\Models\Config;
class CreateCoordinatePermissions extends Migration
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment