Unverified Commit 27397fa7 authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #380 from vidhyut-pandya/develop

Misc Changes
parents 8e8f320b 382de0ce
...@@ -82,7 +82,7 @@ class BlogTagsController extends APIController ...@@ -82,7 +82,7 @@ class BlogTagsController extends APIController
$validation = $this->validatingRequest($request, $blog_tag->id); $validation = $this->validatingRequest($request, $blog_tag->id);
if ($validation->fails()) { if ($validation->fails()) {
return $this->throwValidation($validation); return $this->throwValidation($validation->messages()->first());
} }
$this->repository->update($blog_tag, $request->all()); $this->repository->update($blog_tag, $request->all());
......
...@@ -31,7 +31,7 @@ class PagesController extends APIController ...@@ -31,7 +31,7 @@ class PagesController extends APIController
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC'; $orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : config('module.pages.table', 'pages').'created_at'; $sortBy = $request->get('sortBy') ? $request->get('sortBy') : config('module.pages.table', 'pages').'.created_at';
return PagesResource::collection( return PagesResource::collection(
$this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
......
...@@ -22,6 +22,15 @@ class RedirectIfAuthenticated ...@@ -22,6 +22,15 @@ class RedirectIfAuthenticated
return redirect('/'); return redirect('/');
} }
if ($request->wantsJson() && auth()->guard('api')->user()) {
return response([
'error' => [
'message' => 'Not allowed',
'status_code' => 403,
],
], 403);
}
return $next($request); return $next($request);
} }
} }
...@@ -13,18 +13,16 @@ ...@@ -13,18 +13,16 @@
*/ */
Route::group(['namespace' => 'Api\V1', 'prefix' => 'v1', 'as' => 'v1.'], function () { Route::group(['namespace' => 'Api\V1', 'prefix' => 'v1', 'as' => 'v1.'], function () {
Route::group(['prefix' => 'auth'], function () { Route::group(['prefix' => 'auth', 'middleware' => ['guest']], function () {
Route::post('register', 'RegisterController@register'); Route::post('register', 'RegisterController@register');
Route::post('login', 'AuthController@login'); Route::post('login', 'AuthController@login');
// Password Reset
Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail');
}); });
Route::group(['middleware' => ['auth:api']], function () { Route::group(['middleware' => ['auth:api']], function () {
Route::group(['prefix' => 'auth'], function () { Route::group(['prefix' => 'auth'], function () {
Route::post('logout', 'AuthController@logout'); Route::post('logout', 'AuthController@logout');
Route::post('refresh', 'AuthController@refresh');
// Password Reset Routes
Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail');
// Route::post('password/reset', 'ResetPasswordController@reset')->name('password.reset'); // Route::post('password/reset', 'ResetPasswordController@reset')->name('password.reset');
}); });
// Users // Users
...@@ -36,7 +34,6 @@ Route::group(['namespace' => 'Api\V1', 'prefix' => 'v1', 'as' => 'v1.'], functio ...@@ -36,7 +34,6 @@ Route::group(['namespace' => 'Api\V1', 'prefix' => 'v1', 'as' => 'v1.'], functio
// Roles // Roles
Route::resource('roles', 'RolesController', ['except' => ['create', 'edit']]); Route::resource('roles', 'RolesController', ['except' => ['create', 'edit']]);
Route::post('roles/delete-all', 'RolesController@deleteAll');
// Permission // Permission
Route::resource('permissions', 'PermissionController', ['except' => ['create', 'edit']]); Route::resource('permissions', 'PermissionController', ['except' => ['create', 'edit']]);
......
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