Skip to content

Commit

Permalink
role permission team user profile crud api added
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Sep 22, 2023
1 parent 8980492 commit 6ad12fc
Show file tree
Hide file tree
Showing 70 changed files with 5,952 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"require": {
"php": "^8.1",
"illuminate/contracts": "^10.0",
"laravel/sanctum": "^3.3"
"laravel/sanctum": "^3.3",
"spatie/laravel-permission": "^5.11"
},
"require-dev": {
"laravel/pint": "^1.0",
Expand Down
6 changes: 6 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
->middleware('auth')
->name('logout');

Route::apiResource('users', \Fintech\Auth\Http\Controllers\UserController::class);
// Route::apiResource('roles', \Fintech\Auth\Http\Controllers\RoleController::class);
// Route::apiResource('permissions', \Fintech\Auth\Http\Resources\PermissionCollection::class);
// Route::apiResource('teams', \Fintech\Auth\Http\Controllers\TeamController::class);
Route::apiSingleton('users.profile', \Fintech\Auth\Http\Controllers\ProfileController::class);
});
});

Expand Down
41 changes: 41 additions & 0 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,47 @@

namespace Fintech\Auth;

use Illuminate\Contracts\Container\BindingResolutionException;

class Auth
{
/**
* @return \Fintech\Auth\Services\UserService
*
* @throws BindingResolutionException
*/
public function user()
{
return app()->make(\Fintech\Auth\Services\UserService::class);
}

/**
* @return \Fintech\Auth\Services\RoleService
*
* @throws BindingResolutionException
*/
public function role()
{
return app()->make(\Fintech\Auth\Services\RoleService::class);
}

/**
* @return \Fintech\Auth\Services\PermissionService
*
* @throws BindingResolutionException
*/
public function permission()
{
return app()->make(\Fintech\Auth\Services\PermissionService::class);
}

/**
* @return \Fintech\Auth\Services\TeamService
*
* @throws BindingResolutionException
*/
public function team()
{
return app()->make(\Fintech\Auth\Services\TeamService::class);
}
}
15 changes: 15 additions & 0 deletions src/Exceptions/PermissionRepositoryException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Fintech\Auth\Exceptions;

/**
* Class PermissionRepositoryException
* @package Fintech\Auth\Exceptions
*/
class PermissionRepositoryException extends \Exception
{
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
15 changes: 15 additions & 0 deletions src/Exceptions/RoleRepositoryException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Fintech\Auth\Exceptions;

/**
* Class RoleRepositoryException
* @package Fintech\Auth\Exceptions
*/
class RoleRepositoryException extends \Exception
{
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
15 changes: 15 additions & 0 deletions src/Exceptions/TeamRepositoryException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Fintech\Auth\Exceptions;

/**
* Class TeamRepositoryException
* @package Fintech\Auth\Exceptions
*/
class TeamRepositoryException extends \Exception
{
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
15 changes: 15 additions & 0 deletions src/Exceptions/UserProfileRepositoryException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Fintech\Auth\Exceptions;

/**
* Class UserProfileRepositoryException
* @package Fintech\Auth\Exceptions
*/
class UserProfileRepositoryException extends \Exception
{
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
15 changes: 15 additions & 0 deletions src/Exceptions/UserRepositoryException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Fintech\Auth\Exceptions;

/**
* Class UserRepositoryException
* @package Fintech\Auth\Exceptions
*/
class UserRepositoryException extends \Exception
{
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
4 changes: 4 additions & 0 deletions src/Facades/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

/**
* @see \Fintech\Auth\Auth
* @method static \Fintech\Auth\Services\UserService user()
* @method static \Fintech\Auth\Services\RoleService role()
* @method static \Fintech\Auth\Services\PermissionService permission()
* @method static \Fintech\Auth\Services\TeamService team()
*/
class Auth extends Facade
{
Expand Down
Loading

0 comments on commit 6ad12fc

Please sign in to comment.