Unverified Commit 811f969a authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #246 from viralsolani/develop

Merge Develop to master
parents dafb3a3a e38cf422
...@@ -54,6 +54,9 @@ Generate a new application key ...@@ -54,6 +54,9 @@ Generate a new application key
php artisan key:generate php artisan key:generate
Generate a new JWT secret key (If you want to use API)
php artisan jwt:secret
Generate a new JWT authentication secret key Generate a new JWT authentication secret key
php artisan jwt:secret php artisan jwt:secret
...@@ -79,7 +82,7 @@ For generating the files of unisharp file manager ...@@ -79,7 +82,7 @@ For generating the files of unisharp file manager
php artisan vendor:publish --tag=lfm_public php artisan vendor:publish --tag=lfm_public
For linking storage folder in public For linking storage folder in public
php artisan storage:link php artisan storage:link
Start the local development server Start the local development server
......
<?php <?php
Breadcrumbs::register('admin.blogcategories.index', function ($breadcrumbs) { Breadcrumbs::register('admin.blogCategories.index', function ($breadcrumbs) {
$breadcrumbs->parent('admin.dashboard'); $breadcrumbs->parent('admin.dashboard');
$breadcrumbs->push(trans('menus.backend.blogcategories.management'), route('admin.blogcategories.index')); $breadcrumbs->push(trans('menus.backend.blogcategories.management'), route('admin.blogCategories.index'));
}); });
Breadcrumbs::register('admin.blogcategories.create', function ($breadcrumbs) { Breadcrumbs::register('admin.blogCategories.create', function ($breadcrumbs) {
$breadcrumbs->parent('admin.blogcategories.index'); $breadcrumbs->parent('admin.blogCategories.index');
$breadcrumbs->push(trans('menus.backend.blogcategories.create'), route('admin.blogcategories.create')); $breadcrumbs->push(trans('menus.backend.blogcategories.create'), route('admin.blogCategories.create'));
}); });
Breadcrumbs::register('admin.blogcategories.edit', function ($breadcrumbs, $id) { Breadcrumbs::register('admin.blogCategories.edit', function ($breadcrumbs, $id) {
$breadcrumbs->parent('admin.blogcategories.index'); $breadcrumbs->parent('admin.blogCategories.index');
$breadcrumbs->push(trans('menus.backend.blogcategories.edit'), route('admin.blogcategories.edit', $id)); $breadcrumbs->push(trans('menus.backend.blogcategories.edit'), route('admin.blogCategories.edit', $id));
}); });
<?php <?php
Breadcrumbs::register('admin.blogtags.index', function ($breadcrumbs) { Breadcrumbs::register('admin.blogTags.index', function ($breadcrumbs) {
$breadcrumbs->parent('admin.dashboard'); $breadcrumbs->parent('admin.dashboard');
$breadcrumbs->push(trans('menus.backend.blogtags.management'), route('admin.blogtags.index')); $breadcrumbs->push(trans('menus.backend.blogtags.management'), route('admin.blogTags.index'));
}); });
Breadcrumbs::register('admin.blogtags.create', function ($breadcrumbs) { Breadcrumbs::register('admin.blogTags.create', function ($breadcrumbs) {
$breadcrumbs->parent('admin.blogtags.index'); $breadcrumbs->parent('admin.blogTags.index');
$breadcrumbs->push(trans('menus.backend.blogtags.create'), route('admin.blogtags.create')); $breadcrumbs->push(trans('menus.backend.blogtags.create'), route('admin.blogTags.create'));
}); });
Breadcrumbs::register('admin.blogtags.edit', function ($breadcrumbs, $id) { Breadcrumbs::register('admin.blogTags.edit', function ($breadcrumbs, $id) {
$breadcrumbs->parent('admin.blogtags.index'); $breadcrumbs->parent('admin.blogTags.index');
$breadcrumbs->push(trans('menus.backend.blogtags.edit'), route('admin.blogtags.edit', $id)); $breadcrumbs->push(trans('menus.backend.blogtags.edit'), route('admin.blogTags.edit', $id));
}); });
...@@ -32,9 +32,11 @@ class BlogCategoriesController extends APIController ...@@ -32,9 +32,11 @@ class BlogCategoriesController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return BlogCategoriesResource::collection( return BlogCategoriesResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
......
...@@ -30,9 +30,11 @@ class BlogTagsController extends APIController ...@@ -30,9 +30,11 @@ class BlogTagsController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return BlogTagsResource::collection( return BlogTagsResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
......
...@@ -30,9 +30,11 @@ class BlogsController extends APIController ...@@ -30,9 +30,11 @@ class BlogsController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return BlogsResource::collection( return BlogsResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
......
...@@ -30,9 +30,11 @@ class DeactivatedUsersController extends APIController ...@@ -30,9 +30,11 @@ class DeactivatedUsersController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return UserResource::collection( return UserResource::collection(
$this->repository->getForDataTable(0, false)->paginate($limit) $this->repository->getForDataTable(0, false)->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
} }
...@@ -30,9 +30,11 @@ class DeletedUsersController extends APIController ...@@ -30,9 +30,11 @@ class DeletedUsersController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return UserResource::collection( return UserResource::collection(
$this->repository->getForDataTable(0, true)->paginate($limit) $this->repository->getForDataTable(0, true)->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
} }
...@@ -30,9 +30,11 @@ class FaqsController extends APIController ...@@ -30,9 +30,11 @@ class FaqsController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return FaqsResource::collection( return FaqsResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
......
...@@ -30,9 +30,11 @@ class PagesController extends APIController ...@@ -30,9 +30,11 @@ class PagesController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return PagesResource::collection( return PagesResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
......
...@@ -32,9 +32,11 @@ class PermissionController extends APIController ...@@ -32,9 +32,11 @@ class PermissionController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return PermissionResource::collection( return PermissionResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
...@@ -104,6 +106,7 @@ class PermissionController extends APIController ...@@ -104,6 +106,7 @@ class PermissionController extends APIController
$this->repository->delete($permission); $this->repository->delete($permission);
return $this->respond([ return $this->respond([
'data' => $permission->id,
'message' => trans('alerts.backend.permissions.deleted'), 'message' => trans('alerts.backend.permissions.deleted'),
]); ]);
} }
......
...@@ -32,9 +32,11 @@ class RolesController extends APIController ...@@ -32,9 +32,11 @@ class RolesController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return RoleResource::collection( return RoleResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
...@@ -60,6 +62,7 @@ class RolesController extends APIController ...@@ -60,6 +62,7 @@ class RolesController extends APIController
public function store(Request $request) public function store(Request $request)
{ {
$validation = $this->validateRole($request); $validation = $this->validateRole($request);
if ($validation->fails()) { if ($validation->fails()) {
return $this->throwValidation($validation->messages()->first()); return $this->throwValidation($validation->messages()->first());
} }
...@@ -105,6 +108,7 @@ class RolesController extends APIController ...@@ -105,6 +108,7 @@ class RolesController extends APIController
$this->repository->delete($role); $this->repository->delete($role);
return $this->respond([ return $this->respond([
'data' => $role->id,
'message' => trans('alerts.backend.roles.deleted'), 'message' => trans('alerts.backend.roles.deleted'),
]); ]);
} }
......
...@@ -32,9 +32,11 @@ class UsersController extends APIController ...@@ -32,9 +32,11 @@ class UsersController extends APIController
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
$orderBy = $request->get('orderBy') ? $request->get('orderBy') : 'ASC';
$sortBy = $request->get('sortBy') ? $request->get('sortBy') : 'created_at';
return UserResource::collection( return UserResource::collection(
$this->repository->getForDataTable(1, false)->paginate($limit) $this->repository->getForDataTable(1, false)->orderBy($sortBy, $orderBy)->paginate($limit)
); );
} }
...@@ -106,6 +108,7 @@ class UsersController extends APIController ...@@ -106,6 +108,7 @@ class UsersController extends APIController
$this->repository->delete($user); $this->repository->delete($user);
return $this->respond([ return $this->respond([
'data' => $user->id,
'message' => trans('alerts.backend.users.deleted'), 'message' => trans('alerts.backend.users.deleted'),
]); ]);
} }
......
...@@ -9,6 +9,7 @@ use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest; ...@@ -9,6 +9,7 @@ use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest; use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest; use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest; use App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest;
use App\Http\Responses\Backend\BlogCategory\EditResponse;
use App\Http\Responses\RedirectResponse; use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse; use App\Http\Responses\ViewResponse;
use App\Models\BlogCategories\BlogCategory; use App\Models\BlogCategories\BlogCategory;
...@@ -65,7 +66,7 @@ class BlogCategoriesController extends Controller ...@@ -65,7 +66,7 @@ class BlogCategoriesController extends Controller
* @param \App\Models\BlogCategories\BlogCategory $blogCategory * @param \App\Models\BlogCategories\BlogCategory $blogCategory
* @param \App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest $request * @param \App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest $request
* *
* @return mixed * @return \App\Http\Responses\Backend\BlogCategory\EditResponse
*/ */
public function edit(BlogCategory $blogCategory, EditBlogCategoriesRequest $request) public function edit(BlogCategory $blogCategory, EditBlogCategoriesRequest $request)
{ {
......
...@@ -22,14 +22,6 @@ class FrontendController extends Controller ...@@ -22,14 +22,6 @@ class FrontendController extends Controller
return view('frontend.index', compact('google_analytics', $google_analytics)); return view('frontend.index', compact('google_analytics', $google_analytics));
} }
/**
* @return \Illuminate\View\View
*/
public function macros()
{
return view('frontend.macros');
}
/** /**
* show page by $page_slug. * show page by $page_slug.
*/ */
......
<?php
namespace App\Http\Middleware;
use Closure;
use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
class VerifyJWTToken
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
try {
$user = JWTAuth::parseToken()->authenticate();
} catch (JWTException $e) {
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
return response()->json(['token_expired'], $e->getStatusCode());
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
return response()->json(['token_invalid'], $e->getStatusCode());
} else {
return response()->json(['error' => 'Token is required']);
}
}
return $next($request);
}
}
...@@ -27,7 +27,7 @@ class UpdateBlogCategoriesRequest extends Request ...@@ -27,7 +27,7 @@ class UpdateBlogCategoriesRequest extends Request
public function rules() public function rules()
{ {
return [ return [
'name' => 'required|max:191', 'name' => 'required|max:191|unique:blog_categories,name,'.$this->segment(3),
]; ];
} }
...@@ -39,6 +39,7 @@ class UpdateBlogCategoriesRequest extends Request ...@@ -39,6 +39,7 @@ class UpdateBlogCategoriesRequest extends Request
public function messages() public function messages()
{ {
return [ return [
'name.unique' => 'Blog category name already exists, please enter a different name.',
'name.required' => 'Blog category name must required', 'name.required' => 'Blog category name must required',
'name.max' => 'Blog category may not be greater than 191 characters.', 'name.max' => 'Blog category may not be greater than 191 characters.',
]; ];
......
...@@ -27,7 +27,7 @@ class UpdateBlogTagsRequest extends Request ...@@ -27,7 +27,7 @@ class UpdateBlogTagsRequest extends Request
public function rules() public function rules()
{ {
return [ return [
'name' => 'required|max:191', 'name' => 'required|max:191|unique:blog_tags,name,'.$this->segment(3),
]; ];
} }
...@@ -39,6 +39,7 @@ class UpdateBlogTagsRequest extends Request ...@@ -39,6 +39,7 @@ class UpdateBlogTagsRequest extends Request
public function messages() public function messages()
{ {
return [ return [
'name.unique' => 'Blog Tag name already exists, please enter a different name.',
'name.required' => 'Blog Tag name is a required field.', 'name.required' => 'Blog Tag name is a required field.',
'name.max' => 'Blog Tag may not be greater than 191 characters.', 'name.max' => 'Blog Tag may not be greater than 191 characters.',
]; ];
......
...@@ -27,7 +27,7 @@ class UpdateBlogsRequest extends Request ...@@ -27,7 +27,7 @@ class UpdateBlogsRequest extends Request
public function rules() public function rules()
{ {
return [ return [
'name' => 'required|max:191', 'name' => 'required|max:191|unique:blogs,name,'.$this->segment(3),
'content' => 'required', 'content' => 'required',
'categories' => 'required', 'categories' => 'required',
'tags' => 'required', 'tags' => 'required',
...@@ -42,6 +42,7 @@ class UpdateBlogsRequest extends Request ...@@ -42,6 +42,7 @@ class UpdateBlogsRequest extends Request
public function messages() public function messages()
{ {
return [ return [
'name.unique' => 'Blog name already exists, please enter a different name.',
'name.required' => 'Please insert Blog Title', 'name.required' => 'Please insert Blog Title',
'name.max' => 'Blog Title may not be greater than 191 characters.', 'name.max' => 'Blog Title may not be greater than 191 characters.',
]; ];
......
...@@ -18,8 +18,8 @@ class RoleResource extends Resource ...@@ -18,8 +18,8 @@ class RoleResource extends Resource
return [ return [
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => $this->name,
'permission' => ($this->all) ? 'All' : optional($this->permissions)->pluck('display_name'), 'permissions' => ($this->all) ? 'All' : optional($this->permissions)->pluck('display_name'),
'noofuses' => $this->users->count(), 'number_of_users' => $this->users->count(),
'sort' => $this->sort, 'sort' => $this->sort,
'status' => $this->status, 'status' => $this->status,
'registered_at' => $this->created_at->toIso8601String(), 'registered_at' => $this->created_at->toIso8601String(),
......
...@@ -25,8 +25,8 @@ class UserResource extends Resource ...@@ -25,8 +25,8 @@ class UserResource extends Resource
'role' => optional($this->roles()->first())->name, 'role' => optional($this->roles()->first())->name,
'permissions' => $this->permissions()->get(), 'permissions' => $this->permissions()->get(),
'status' => $this->status, 'status' => $this->status,
'registered_at' => $this->created_at->toIso8601String(), 'created_at' => $this->created_at->toIso8601String(),
'last_updated_at' => $this->updated_at->toIso8601String(), 'updated_at' => $this->updated_at->toIso8601String(),
]; ];
} }
} }
<?php <?php
namespace App\Http\Responses\Backend\Menu; namespace App\Http\Responses\Backend\BlogCategory;
use Illuminate\Contracts\Support\Responsable; use Illuminate\Contracts\Support\Responsable;
...@@ -14,7 +14,7 @@ class EditResponse implements Responsable ...@@ -14,7 +14,7 @@ class EditResponse implements Responsable
/** /**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory * @param \App\Models\BlogCategories\BlogCategory $blogCategory
*/ */
public function __construct($blogCategory, $types, $modules) public function __construct($blogCategory)
{ {
$this->blogCategory = $blogCategory; $this->blogCategory = $blogCategory;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}, },
"devDependencies": { "devDependencies": {
"axios": "^0.17", "axios": "^0.18",
"bootstrap-sass": "^3.3.7", "bootstrap-sass": "^3.3.7",
"cross-env": "^5.1", "cross-env": "^5.1",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
"datatables.net-buttons": "^1.3.1", "datatables.net-buttons": "^1.3.1",
"moment": "^2.18.1", "moment": "^2.18.1",
"nestable2": "^1.5.0", "nestable2": "^1.5.0",
"node-sass": "^4.9.0",
"pluralize": "^7.0.0", "pluralize": "^7.0.0",
"select2": "^4.0.4", "select2": "^4.0.4",
"tinymce": "^4.5.8" "tinymce": "^4.5.8"
......
...@@ -743,7 +743,7 @@ function _init() { ...@@ -743,7 +743,7 @@ function _init() {
* or customize the JavaScript scaffolding to fit your unique needs. * or customize the JavaScript scaffolding to fit your unique needs.
*/ */
Vue.component('flash', require('../components/backend/Flash.vue')); Vue.component('flash', require('../components/Flash.vue'));
Vue.component('export-component', require('../components/backend/Export.vue')); Vue.component('export-component', require('../components/backend/Export.vue'));
const app = new Vue({ const app = new Vue({
......
...@@ -29,11 +29,16 @@ export default { ...@@ -29,11 +29,16 @@ export default {
methods: { methods: {
flash(message, type) { flash(message, type) {
this.body = message;
this.typeClass = "alert alert-" + type; if (! type) {
this.show = true; type = "info";
}
this.hide(); this.body = message;
this.typeClass = "alert alert-" + type;
this.show = true;
this.hide();
}, },
hide() { hide() {
......
...@@ -13,6 +13,7 @@ require('../bootstrap'); ...@@ -13,6 +13,7 @@ require('../bootstrap');
* or customize the JavaScript scaffolding to fit your unique needs. * or customize the JavaScript scaffolding to fit your unique needs.
*/ */
Vue.component('flash', require('../components/Flash.vue'));
Vue.component('example', require('../components/frontend/Example.vue')); Vue.component('example', require('../components/frontend/Example.vue'));
const app = new Vue({ const app = new Vue({
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<h3 class="box-title">{{ trans('labels.backend.faqs.create') }}</h3> <h3 class="box-title">{{ trans('labels.backend.faqs.create') }}</h3>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
@include('backend.includes.partials.faqs-header-buttons') @include('backend.faqs.partials.faqs-header-buttons')
</div><!--box-tools pull-right--> </div><!--box-tools pull-right-->
</div><!-- /.box-header --> </div><!-- /.box-header -->
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<h3 class="box-title">{{ trans('labels.backend.faqs.edit') }}</h3> <h3 class="box-title">{{ trans('labels.backend.faqs.edit') }}</h3>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
@include('backend.includes.partials.faqs-header-buttons') @include('backend.faqs.partials.faqs-header-buttons')
</div><!--box-tools pull-right--> </div><!--box-tools pull-right-->
</div><!-- /.box-header --> </div><!-- /.box-header -->
...@@ -34,4 +34,4 @@ ...@@ -34,4 +34,4 @@
</div><!--box--> </div><!--box-->
</div> </div>
{{ Form::close() }} {{ Form::close() }}
@endsection @endsection
\ No newline at end of file
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
<!-- Scripts --> <!-- Scripts -->
<script> <script>
window.Laravel = <?php echo json_encode([ window.Laravel = {!! json_encode([ 'csrfToken' => csrf_token() ]) !!};
'csrfToken' => csrf_token(),
]); ?>
</script> </script>
</head> </head>
<body class="skin-{{ config('backend.theme') }} {{ config('backend.layout') }}"> <body class="skin-{{ config('backend.theme') }} {{ config('backend.layout') }}">
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
</div><!--navbar-header--> </div><!--navbar-header-->
<div class="collapse navbar-collapse" id="frontend-navbar-collapse"> <div class="collapse navbar-collapse" id="frontend-navbar-collapse">
<ul class="nav navbar-nav"> {{-- <ul class="nav navbar-nav">
<li>{{ link_to_route('frontend.macros', trans('navs.frontend.macros')) }}</li> <li></li>
</ul> </ul> --}}
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
@if (config('locale.status') && count(config('locale.languages')) > 1) @if (config('locale.status') && count(config('locale.languages')) > 1)
<li class="dropdown"> <li class="dropdown">
......
@extends('frontend.layouts.app')
@section('content')
<div class="row">
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-home"></i> {{ trans('labels.frontend.macros.macro_examples') }}</div>
<div class="panel-body">
<div class="form-group">
<label>{{ trans('labels.frontend.macros.state.us.us') }}</label>
{{-- Shorthand for this is just selectState, set which version is shorthanded in Macros/Dropdowns --}}
{{ Form::selectStateUS('state', 'NY', ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.state.us.outlying') }}</label>
{{ Form::selectStateUSOutlyingTerritories('state_outlying', null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.state.us.armed') }}</label>
{{ Form::selectStateUSArmedForces('armed_forces', null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.territories.canada') }}</label>
{{ Form::selectCanadaTerritories('canada_territories', null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.state.mexico') }}</label>
{{ Form::selectStateMexico('mexico', null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.country.alpha') }}</label>
{{ Form::selectCountryAlpha('country_alpha', 'ISO 3166-2:US', ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.country.alpha2') }}</label>
{{-- Shorthand for this is just selectCountry, set which version is shorthanded in Macros/Dropdowns --}}
{{ Form::selectCountryAlpha2('country_alpha2', 'US', ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.country.alpha3') }}</label>
{{ Form::selectCountryAlpha3('country_alpha3', 'USA', ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.country.numeric') }}</label>
{{ Form::selectCountryNumeric('country_numeric', '840', ['class' => 'form-control']) }}
</div>
<div class="form-group">
<label>{{ trans('labels.frontend.macros.timezone') }}</label>
{{ Form::selectTimezone('timezone', 'America/New_York', ['class' => 'form-control']) }}
</div>
</div>
</div><!-- panel -->
</div><!-- col-md-10 -->
</div><!-- row -->
@endsection
\ No newline at end of file
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* All route names are prefixed with 'frontend.'. * All route names are prefixed with 'frontend.'.
*/ */
Route::get('/', 'FrontendController@index')->name('index'); Route::get('/', 'FrontendController@index')->name('index');
Route::get('macros', 'FrontendController@macros')->name('macros');
Route::post('/get/states', 'FrontendController@getStates')->name('get.states'); Route::post('/get/states', 'FrontendController@getStates')->name('get.states');
Route::post('/get/cities', 'FrontendController@getCities')->name('get.cities'); Route::post('/get/cities', 'FrontendController@getCities')->name('get.cities');
......
...@@ -76,4 +76,17 @@ class ManageBlogCategoriesTest extends TestCase ...@@ -76,4 +76,17 @@ class ManageBlogCategoriesTest extends TestCase
$this->assertDatabaseMissing(config('module.blog_categories.table'), ['name' => $category->name, 'id' => $category->id, 'deleted_at' => null]); $this->assertDatabaseMissing(config('module.blog_categories.table'), ['name' => $category->name, 'id' => $category->id, 'deleted_at' => null]);
} }
/** @test */
public function a_user_can_not_update_a_blog_category_with_same_name()
{
$this->actingAs($this->admin)->withExceptionHandling();
$catCategory = create(BlogCategory::class, ['name' => 'Cat']);
$dogCategory = create(BlogCategory::class, ['name' => 'Dog']);
$this->patch(route('admin.blogCategories.update', $dogCategory),
['name' => 'Cat']
)->assertSessionHasErrors('name');
}
} }
...@@ -76,4 +76,17 @@ class ManageBlogTagsTest extends TestCase ...@@ -76,4 +76,17 @@ class ManageBlogTagsTest extends TestCase
$this->assertDatabaseMissing(config('module.blog_tags.table'), ['name' => $tag->name, 'id' => $tag->id, 'deleted_at' => null]); $this->assertDatabaseMissing(config('module.blog_tags.table'), ['name' => $tag->name, 'id' => $tag->id, 'deleted_at' => null]);
} }
/** @test */
public function a_user_can_not_update_a_blog_tag_with_same_name()
{
$this->actingAs($this->admin)->withExceptionHandling();
$catTag = create(BlogTag::class, ['name' => 'Cat']);
$dogTag = create(BlogTag::class, ['name' => 'Dog']);
$this->patch(route('admin.blogTags.update', $dogTag),
['name' => 'Cat']
)->assertSessionHasErrors('name');
}
} }
...@@ -196,4 +196,17 @@ class ManageBlogsTest extends TestCase ...@@ -196,4 +196,17 @@ class ManageBlogsTest extends TestCase
$this->assertDatabaseMissing(config('module.blogs.table'), ['id' => $this->blog->id, 'deleted_at' => null]); $this->assertDatabaseMissing(config('module.blogs.table'), ['id' => $this->blog->id, 'deleted_at' => null]);
} }
/** @test */
public function a_user_can_not_update_a_blog_with_same_name()
{
$this->actingAs($this->admin)->withExceptionHandling();
$catCategory = create(Blog::class, ['name' => 'Cat']);
$dogCategory = create(Blog::class, ['name' => 'Dog']);
$this->patch(route('admin.blogs.update', $dogCategory),
['name' => 'Cat']
)->assertSessionHasErrors('name');
}
} }
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