Unverified Commit 781f175d authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #231 from viralsolani/develop

Merge Develop Branch
parents 9f05ba48 5d765f2a
......@@ -21,6 +21,11 @@ CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
#Session Timeout
SESSION_TIMEOUT_STATUS=true
#In Seconds
SESSION_TIMEOUT=600
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
......@@ -28,6 +33,8 @@ REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_FROM=viral.solani@gmail.com
MAIL_FROM_NAME=Admin
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
......
......@@ -27,6 +27,8 @@ Give your project a Head Start by using [laravel-adminpanel](https://github.com/
## Built-in Laravel Boilerplate Module Generator
It gives you the ability to create a module using a sweet GUI, where you put in the Module Name and it will generate all the necessary files for you, like Model, Traits, Relationship, Migration, Controllers, Views and routes. So when you are done creating a module, you can directly go to the route generated and see your new module. Since, this does not have the ability to generate table fields for now, so you have to write the migration file that is generated and run a manual php artisan migrate command, and you are good to go.
We are using the module generator as a package, you can find it here: [Module Generator For Laravel Adminpanel](https://github.com/bvipul/generator).
## Installation
Please check the official laravel installation guide for server requirements before you start. [Official Documentation](https://laravel.com/docs/5.6/installation#installation)
......
<?php
namespace App\Helpers\Macros;
use App\Helpers\Macros\Traits\Dropdowns;
use Collective\Html\FormBuilder;
/**
* Class Macros.
*/
class Macros extends FormBuilder
{
use Dropdowns;
}
This diff is collapsed.
<?php
/**
* Represents a universally unique identifier (UUID), according to RFC 4122.
*
* This class provides the static methods `uuid3()`, `uuid4()`, and
* `uuid5()` for generating version 3, 4, and 5 UUIDs as specified in RFC 4122.
*
* If all you want is a unique ID, you should call `uuid4()`.
*
* @link http://tools.ietf.org/html/rfc4122
* @link http://en.wikipedia.org/wiki/Universally_unique_identifier
* @link http://www.php.net/manual/en/function.uniqid.php#94959
*/
namespace App\Helpers;
class uuid
{
/**
* When this namespace is specified, the name string is a fully-qualified domain name.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
/**
* When this namespace is specified, the name string is a URL.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
/**
* When this namespace is specified, the name string is an ISO OID.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
/**
* When this namespace is specified, the name string is an X.500 DN in DER or a text output format.
*
* @link http://tools.ietf.org/html/rfc4122#appendix-C
*/
const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
/**
* The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
*
* @link http://tools.ietf.org/html/rfc4122#section-4.1.7
*/
const NIL = '00000000-0000-0000-0000-000000000000';
private static function getBytes($uuid)
{
if (!self::isValid($uuid)) {
throw new InvalidArgumentException('Invalid UUID string: '.$uuid);
}
// Get hexadecimal components of UUID
$uhex = str_replace([
'urn:',
'uuid:',
'-',
'{',
'}',
], '', $uuid);
// Binary Value
$ustr = '';
// Convert UUID to bits
for ($i = 0; $i < strlen($uhex); $i += 2) {
$ustr .= chr(hexdec($uhex[$i].$uhex[$i + 1]));
}
return $ustr;
}
private static function uuidFromHash($hash, $version)
{
return sprintf('%08s-%04s-%04x-%04x-%12s',
// 32 bits for "time_low"
substr($hash, 0, 8),
// 16 bits for "time_mid"
substr($hash, 8, 4),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number
(hexdec(substr($hash, 12, 4)) & 0x0fff) | $version << 12,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
// 48 bits for "node"
substr($hash, 20, 12));
}
/**
* Generate a version 3 UUID based on the MD5 hash of a namespace identifier
* (which is a UUID) and a name (which is a string).
*
* @param string $namespace The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
*
* @return string
*/
public static function uuid3($namespace, $name)
{
$nbytes = self::getBytes($namespace);
// Calculate hash value
$hash = md5($nbytes.$name);
return self::uuidFromHash($hash, 3);
}
/**
* Generate a version 4 (random) UUID.
*
* @return string
*/
public static function uuid4()
{
$bytes = function_exists('random_bytes') ? random_bytes(16) : openssl_random_pseudo_bytes(16);
$hash = bin2hex($bytes);
return self::uuidFromHash($hash, 4);
}
/**
* Generate a version 5 UUID based on the SHA-1 hash of a namespace
* identifier (which is a UUID) and a name (which is a string).
*
* @param string $namespace The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
*
* @return string
*/
public static function uuid5($namespace, $name)
{
$nbytes = self::getBytes($namespace);
// Calculate hash value
$hash = sha1($nbytes.$name);
return self::uuidFromHash($hash, 5);
}
/**
* Check if a string is a valid UUID.
*
* @param string $uuid The string UUID to test
*
* @return bool
*/
public static function isValid($uuid)
{
return preg_match('/^(urn:)?(uuid:)?(\{)?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{12}(?(3)\}|)$/i', $uuid) === 1;
}
/**
* Check if two UUIDs are equal.
*
* @param string $uuid1 The first UUID to test
* @param string $uuid2 The second UUID to test
*
* @return bool
*/
public static function equals($uuid1, $uuid2)
{
return self::getBytes($uuid1) === self::getBytes($uuid2);
}
}
......@@ -9,6 +9,10 @@ use App\Http\Requests\Backend\Access\Permission\EditPermissionRequest;
use App\Http\Requests\Backend\Access\Permission\ManagePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\StorePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\UpdatePermissionRequest;
use App\Http\Responses\Backend\Access\Permission\CreateResponse;
use App\Http\Responses\Backend\Access\Permission\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\Access\Permission\Permission;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
......@@ -33,71 +37,69 @@ class PermissionController extends Controller
/**
* @param ManagePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManagePermissionRequest $request)
{
return view('backend.access.permissions.index');
return new ViewResponse('backend.access.permissions.index');
}
/**
* @param CreatePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\Permission\CreateResponse
*/
public function create(CreatePermissionRequest $request)
{
return view('backend.access.permissions.create')
->withPermissionCount($this->permissions->getCount());
return new CreateResponse($this->permissions);
}
/**
* @param StorePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StorePermissionRequest $request)
{
$this->permissions->create($request->all());
return redirect()->route('admin.access.permission.index')->withFlashSuccess(trans('alerts.backend.permissions.created'));
return new RedirectResponse(route('admin.access.permission.index'), ['flash_success' => trans('alerts.backend.permissions.created')]);
}
/**
* @param Permission $permission
* @param EditPermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\Permission\EditResponse
*/
public function edit(Permission $permission, EditPermissionRequest $request)
{
return view('backend.access.permissions.edit')
->withPermission($permission);
return new EditResponse($permission);
}
/**
* @param Permission $permission
* @param UpdatePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Permission $permission, UpdatePermissionRequest $request)
{
$this->permissions->update($permission, $request->all());
return redirect()->route('admin.access.permission.index')->withFlashSuccess(trans('alerts.backend.permissions.updated'));
return new RedirectResponse(route('admin.access.permission.index'), ['flash_success' => trans('alerts.backend.permissions.updated')]);
}
/**
* @param Permission $permission
* @param DeletePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Permission $permission, DeletePermissionRequest $request)
{
$this->permissions->delete($permission);
return redirect()->route('admin.access.permission.index')->withFlashSuccess(trans('alerts.backend.permissions.deleted'));
return new RedirectResponse(route('admin.access.permission.index'), ['flash_success' => trans('alerts.backend.permissions.deleted')]);
}
}
......@@ -9,6 +9,10 @@ use App\Http\Requests\Backend\Access\Role\EditRoleRequest;
use App\Http\Requests\Backend\Access\Role\ManageRoleRequest;
use App\Http\Requests\Backend\Access\Role\StoreRoleRequest;
use App\Http\Requests\Backend\Access\Role\UpdateRoleRequest;
use App\Http\Responses\Backend\Access\Role\CreateResponse;
use App\Http\Responses\Backend\Access\Role\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\Access\Role\Role;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
use App\Repositories\Backend\Access\Role\RoleRepository;
......@@ -19,18 +23,18 @@ use App\Repositories\Backend\Access\Role\RoleRepository;
class RoleController extends Controller
{
/**
* @var RoleRepository
* @var \App\Repositories\Backend\Access\Role\RoleRepository
*/
protected $roles;
/**
* @var PermissionRepository
* @var \App\Repositories\Backend\Access\Permission\PermissionRepository
*/
protected $permissions;
/**
* @param RoleRepository $roles
* @param PermissionRepository $permissions
* @param \App\Repositories\Backend\Access\Role\RoleRepository $roles
* @param \App\Repositories\Backend\Access\Permission\PermissionRepository $permissions
*/
public function __construct(RoleRepository $roles, PermissionRepository $permissions)
{
......@@ -39,76 +43,71 @@ class RoleController extends Controller
}
/**
* @param ManageRoleRequest $request
* @param \App\Http\Requests\Backend\Access\Role\ManageRoleRequest $request
*
* @return mixed
*/
public function index(ManageRoleRequest $request)
{
return view('backend.access.roles.index');
return new ViewResponse('backend.access.roles.index');
}
/**
* @param CreateRoleRequest $request
* @param \App\Http\Requests\Backend\Access\Role\CreateRoleRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\Role\CreateResponse
*/
public function create(CreateRoleRequest $request)
{
return view('backend.access.roles.create')
->withPermissions($this->permissions->getAll())
->withRoleCount($this->roles->getCount());
return new CreateResponse($this->permissions, $this->roles);
}
/**
* @param StoreRoleRequest $request
* @param \App\Http\Requests\Backend\Access\Role\StoreRoleRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreRoleRequest $request)
{
$this->roles->create($request->all());
return redirect()->route('admin.access.role.index')->withFlashSuccess(trans('alerts.backend.roles.created'));
return new RedirectResponse(route('admin.access.role.index'), ['flash_success' => trans('alerts.backend.roles.created')]);
}
/**
* @param Role $role
* @param EditRoleRequest $request
* @param \App\Models\Access\Role\Role $role
* @param \App\Http\Requests\Backend\Access\Role\EditRoleRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\Role\EditResponse
*/
public function edit(Role $role, EditRoleRequest $request)
{
return view('backend.access.roles.edit')
->withRole($role)
->withRolePermissions($role->permissions->pluck('id')->all())
->withPermissions($this->permissions->getAll());
return new EditResponse($role, $this->permissions);
}
/**
* @param Role $role
* @param UpdateRoleRequest $request
* @param \App\Models\Access\Role\Role $role
* @param \App\Http\Requests\Backend\Access\Role\UpdateRoleRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Role $role, UpdateRoleRequest $request)
{
$this->roles->update($role, $request->all());
return redirect()->route('admin.access.role.index')->withFlashSuccess(trans('alerts.backend.roles.updated'));
return new RedirectResponse(route('admin.access.role.index'), ['flash_success' => trans('alerts.backend.roles.updated')]);
}
/**
* @param Role $role
* @param DeleteRoleRequest $request
* @param \App\Models\Access\Role\Role $role
* @param \App\Http\Requests\Backend\Access\Role\DeleteRoleRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Role $role, DeleteRoleRequest $request)
{
$this->roles->delete($role);
return redirect()->route('admin.access.role.index')->withFlashSuccess(trans('alerts.backend.roles.deleted'));
return new RedirectResponse(route('admin.access.role.index'), ['flash_success' => trans('alerts.backend.roles.deleted')]);
}
}
......@@ -10,6 +10,11 @@ use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Http\Requests\Backend\Access\User\ShowUserRequest;
use App\Http\Requests\Backend\Access\User\StoreUserRequest;
use App\Http\Requests\Backend\Access\User\UpdateUserRequest;
use App\Http\Responses\Backend\Access\User\CreateResponse;
use App\Http\Responses\Backend\Access\User\EditResponse;
use App\Http\Responses\Backend\Access\User\ShowResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\Access\Permission\Permission;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\Role\RoleRepository;
......@@ -21,18 +26,18 @@ use App\Repositories\Backend\Access\User\UserRepository;
class UserController extends Controller
{
/**
* @var UserRepository
* @var \App\Repositories\Backend\Access\User\UserRepository
*/
protected $users;
/**
* @var RoleRepository
* @var \App\Repositories\Backend\Access\Role\RoleRepository
*/
protected $roles;
/**
* @param UserRepository $users
* @param RoleRepository $roles
* @param \App\Repositories\Backend\Access\User\UserRepository $users
* @param \App\Repositories\Backend\Access\Role\RoleRepository $roles
*/
public function __construct(UserRepository $users, RoleRepository $roles)
{
......@@ -41,94 +46,87 @@ class UserController extends Controller
}
/**
* @param ManageUserRequest $request
* @param \App\Http\Requests\Backend\Access\User\ManageUserRequest $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageUserRequest $request)
{
return view('backend.access.users.index');
return new ViewResponse('backend.access.users.index');
}
/**
* @param CreateUserRequest $request
* @param \App\Http\Requests\Backend\Access\User\CreateUserRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\User\CreateResponse
*/
public function create(CreateUserRequest $request)
{
return view('backend.access.users.create')->with([
'roles' => $this->roles->getAll(),
]);
$roles = $this->roles->getAll();
return new CreateResponse($roles);
}
/**
* @param StoreUserRequest $request
* @param \App\Http\Requests\Backend\Access\User\StoreUserRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreUserRequest $request)
{
$this->users->create($request);
return redirect()->route('admin.access.user.index')->withFlashSuccess(trans('alerts.backend.users.created'));
return new RedirectResponse(route('admin.access.user.index'), ['flash_success' => trans('alerts.backend.users.created')]);
}
/**
* @param User $user
* @param ShowUserRequest $request
* @param \App\Models\Access\User\User $user
* @param \App\Http\Requests\Backend\Access\User\ShowUserRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\User\ShowResponse
*/
public function show(User $user, ShowUserRequest $request)
{
return view('backend.access.users.show')
->withUser($user);
return new ShowResponse($user);
}
/**
* @param User $user
* @param EditUserRequest $request
* @param \App\Models\Access\User\User $user
* @param \App\Http\Requests\Backend\Access\User\EditUserRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\User\EditResponse
*/
public function edit(User $user, EditUserRequest $request)
{
$roles = $this->roles->getAll();
$permissions = Permission::getSelectData('display_name');
$userPermissions = $user->permissions()->get()->pluck('id')->toArray();
return view('backend.access.users.edit')->with([
'user' => $user,
'userRoles' => $user->roles->pluck('id')->all(),
'roles' => $this->roles->getAll(),
'userPermissions' => $userPermissions,
'permissions' => $permissions,
]);
return new EditResponse($user, $roles, $permissions);
}
/**
* @param User $user
* @param UpdateUserRequest $request
* @param \App\Models\Access\User\User $user
* @param \App\Http\Requests\Backend\Access\User\UpdateUserRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(User $user, UpdateUserRequest $request)
{
$this->users->update($user, $request);
return redirect()->route('admin.access.user.index')->withFlashSuccess(trans('alerts.backend.users.updated'));
return new RedirectResponse(route('admin.access.user.index'), ['flash_success' => trans('alerts.backend.users.updated')]);
}
/**
* @param User $user
* @param DeleteUserRequest $request
* @param \App\Models\Access\User\User $user
* @param \App\Http\Requests\Backend\Access\User\DeleteUserRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(User $user, DeleteUserRequest $request)
{
$this->users->delete($user);
return redirect()->route('admin.access.user.deleted')->withFlashSuccess(trans('alerts.backend.users.deleted'));
return new RedirectResponse(route('admin.access.user.index'), ['flash_success' => trans('alerts.backend.users.deleted')]);
}
}
......@@ -14,12 +14,12 @@ use Yajra\DataTables\Facades\DataTables;
class UserTableController extends Controller
{
/**
* @var UserRepository
* @var \App\Repositories\Backend\Access\User\UserRepository
*/
protected $users;
/**
* @param UserRepository $users
* @param \App\Repositories\Backend\Access\User\UserRepository $users
*/
public function __construct(UserRepository $users)
{
......@@ -27,7 +27,7 @@ class UserTableController extends Controller
}
/**
* @param ManageUserRequest $request
* @param \App\Http\Requests\Backend\Access\User\ManageUserRequest $request
*
* @return mixed
*/
......
......@@ -9,6 +9,8 @@ use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\BlogCategories\BlogCategory;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
......@@ -30,21 +32,21 @@ class BlogCategoriesController extends Controller
/**
* @param \App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest $request
*
* @return mixed
* @return ViewResponse
*/
public function index(ManageBlogCategoriesRequest $request)
{
return view('backend.blogcategories.index');
return new ViewResponse('backend.blogcategories.index');
}
/**
* @param \App\Http\Requests\Backend\BlogCategories\CreateBlogCategoriesRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreateBlogCategoriesRequest $request)
{
return view('backend.blogcategories.create');
return new ViewResponse('backend.blogcategories.create');
}
/**
......@@ -56,9 +58,7 @@ class BlogCategoriesController extends Controller
{
$this->blogcategory->create($request->all());
return redirect()
->route('admin.blogCategories.index')
->with('flash_success', trans('alerts.backend.blogcategories.created'));
return new RedirectResponse(route('admin.blogCategories.index'), ['flash_success' => trans('alerts.backend.blogcategories.created')]);
}
/**
......@@ -69,37 +69,32 @@ class BlogCategoriesController extends Controller
*/
public function edit(BlogCategory $blogCategory, EditBlogCategoriesRequest $request)
{
return view('backend.blogcategories.edit')
->with('blogcategory', $blogCategory);
return new EditResponse($blogCategory);
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory
* @param \App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(BlogCategory $blogCategory, UpdateBlogCategoriesRequest $request)
{
$this->blogcategory->update($blogCategory, $request->all());
return redirect()
->route('admin.blogCategories.index')
->with('flash_success', trans('alerts.backend.blogcategories.updated'));
return new RedirectResponse(route('admin.blogCategories.index'), ['flash_success' => trans('alerts.backend.blogcategories.updated')]);
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory
* @param \App\Http\Requests\Backend\BlogCategories\DeleteBlogCategoriesRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(BlogCategory $blogCategory, DeleteBlogCategoriesRequest $request)
{
$this->blogcategory->delete($blogCategory);
return redirect()
->route('admin.blogCategories.index')
->with('flash_success', trans('alerts.backend.blogcategories.deleted'));
return new RedirectResponse(route('admin.blogCategories.index'), ['flash_success' => trans('alerts.backend.blogcategories.deleted')]);
}
}
......@@ -9,6 +9,9 @@ use App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\UpdateBlogTagsRequest;
use App\Http\Responses\Backend\BlogTag\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\BlogTags\BlogTag;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
......@@ -33,47 +36,44 @@ class BlogTagsController extends Controller
/**
* @param \App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageBlogTagsRequest $request)
{
return view('backend.blogtags.index');
return new ViewResponse('backend.blogtags.index');
}
/**
* @param \App\Http\Requests\Backend\BlogTags\CreateBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreateBlogTagsRequest $request)
{
return view('backend.blogtags.create');
return new ViewResponse('backend.blogtags.create');
}
/**
* @param \App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreBlogTagsRequest $request)
{
$this->blogtag->create($request->except('token'));
return redirect()
->route('admin.blogTags.index')
->with('flash_success', trans('alerts.backend.blogtags.created'));
return new RedirectResponse(route('admin.blogTags.index'), ['flash_success' => trans('alerts.backend.blogtags.created')]);
}
/**
* @param \App\Models\BlogTags\BlogTag $blogTag
* @param \App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\BlogTag\EditResponse
*/
public function edit(BlogTag $blogTag, EditBlogTagsRequest $request)
{
return view('backend.blogtags.edit')
->with('blogtag', $blogTag);
return new EditResponse($blogTag);
}
/**
......@@ -86,9 +86,7 @@ class BlogTagsController extends Controller
{
$this->blogtag->update($blogTag, $request->except(['_method', '_token']));
return redirect()
->route('admin.blogTags.index')
->with('flash_success', trans('alerts.backend.blogtags.updated'));
return new RedirectResponse(route('admin.blogTags.index'), ['flash_success' => trans('alerts.backend.blogtags.updated')]);
}
/**
......@@ -101,8 +99,6 @@ class BlogTagsController extends Controller
{
$this->blogtag->delete($blogTag);
return redirect()
->route('admin.blogTags.index')
->with('flash_success', trans('alerts.backend.blogtags.deleted'));
return new RedirectResponse(route('admin.blogTags.index'), ['flash_success' => trans('alerts.backend.blogtags.deleted')]);
}
}
......@@ -6,6 +6,10 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Blogs\ManageBlogsRequest;
use App\Http\Requests\Backend\Blogs\StoreBlogsRequest;
use App\Http\Requests\Backend\Blogs\UpdateBlogsRequest;
use App\Http\Responses\Backend\Blog\CreateResponse;
use App\Http\Responses\Backend\Blog\EditResponse;
use App\Http\Responses\Backend\Blog\IndexResponse;
use App\Http\Responses\RedirectResponse;
use App\Models\BlogCategories\BlogCategory;
use App\Models\Blogs\Blog;
use App\Models\BlogTags\BlogTag;
......@@ -42,13 +46,11 @@ class BlogsController extends Controller
/**
* @param \App\Http\Requests\Backend\Blogs\ManageBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Blog\IndexResponse
*/
public function index(ManageBlogsRequest $request)
{
return view('backend.blogs.index')->with([
'status'=> $this->status,
]);
return new IndexResponse($this->status);
}
/**
......@@ -61,56 +63,40 @@ class BlogsController extends Controller
$blogTags = BlogTag::getSelectData();
$blogCategories = BlogCategory::getSelectData();
return view('backend.blogs.create')->with([
'blogCategories' => $blogCategories,
'blogTags' => $blogTags,
'status' => $this->status,
]);
return new CreateResponse($this->status, $blogCategories, $blogTags);
}
/**
* @param \App\Http\Requests\Backend\Blogs\StoreBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreBlogsRequest $request)
{
$this->blog->create($request->except('_token'));
return redirect()
->route('admin.blogs.index')
->with('flash_success', trans('alerts.backend.blogs.created'));
return new RedirectResponse(route('admin.blogs.index'), ['flash_success' => trans('alerts.backend.blogs.created')]);
}
/**
* @param \App\Models\Blogs\Blog $blog
* @param \App\Http\Requests\Backend\Blogs\ManageBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Blog\EditResponse
*/
public function edit(Blog $blog, ManageBlogsRequest $request)
{
$blogCategories = BlogCategory::getSelectData();
$blogTags = BlogTag::getSelectData();
$selectedCategories = $blog->categories->pluck('id')->toArray();
$selectedtags = $blog->tags->pluck('id')->toArray();
return view('backend.blogs.edit')->with([
'blog' => $blog,
'blogCategories' => $blogCategories,
'blogTags' => $blogTags,
'selectedCategories' => $selectedCategories,
'selectedtags' => $selectedtags,
'status' => $this->status,
]);
return new EditResponse($blog, $this->status, $blogCategories, $blogTags);
}
/**
* @param \App\Models\Blogs\Blog $blog
* @param \App\Http\Requests\Backend\Blogs\UpdateBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Blog $blog, UpdateBlogsRequest $request)
{
......@@ -118,23 +104,19 @@ class BlogsController extends Controller
$this->blog->update($blog, $request->except(['_token', '_method']));
return redirect()
->route('admin.blogs.index')
->with('flash_success', trans('alerts.backend.blogs.updated'));
return new RedirectResponse(route('admin.blogs.index'), ['flash_success' => trans('alerts.backend.blogs.updated')]);
}
/**
* @param \App\Models\Blogs\Blog $blog
* @param \App\Http\Requests\Backend\Blogs\ManageBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Blog $blog, ManageBlogsRequest $request)
{
$this->blog->delete($blog);
return redirect()
->route('admin.blogs.index')
->with('flash_success', trans('alerts.backend.blogs.deleted'));
return new RedirectResponse(route('admin.blogs.index'), ['flash_success' => trans('alerts.backend.blogs.deleted')]);
}
}
......@@ -9,11 +9,19 @@ use App\Http\Requests\Backend\Faqs\EditFaqsRequest;
use App\Http\Requests\Backend\Faqs\ManageFaqsRequest;
use App\Http\Requests\Backend\Faqs\StoreFaqsRequest;
use App\Http\Requests\Backend\Faqs\UpdateFaqsRequest;
use App\Http\Responses\Backend\Faq\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\Faqs\Faq;
use App\Repositories\Backend\Faqs\FaqsRepository;
class FaqsController extends Controller
{
/**
* Faq Repository.
*
* @var \App\Repositories\Backend\Faqs\FaqsRepository
*/
protected $faq;
/**
......@@ -29,11 +37,11 @@ class FaqsController extends Controller
*
* @param \App\Http\Requests\Backend\Faqs\ManageFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageFaqsRequest $request)
{
return view('backend.faqs.index');
return new ViewResponse('backend.faqs.index');
}
/**
......@@ -41,11 +49,11 @@ class FaqsController extends Controller
*
* @param \App\Http\Requests\Backend\Faqs\CreateFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreateFaqsRequest $request)
{
return view('backend.faqs.create');
return new ViewResponse('backend.faqs.create');
}
/**
......@@ -53,17 +61,13 @@ class FaqsController extends Controller
*
* @param \App\Http\Requests\Backend\Faqs\StoreFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreFaqsRequest $request)
{
$input = $request->all();
$this->faq->create($request->all());
$this->faq->create($input);
return redirect()
->route('admin.faqs.index')
->with('flash_success', trans('alerts.backend.faqs.created'));
return new RedirectResponse(route('admin.faqs.index'), ['flash_success' => trans('alerts.backend.faqs.created')]);
}
/**
......@@ -72,12 +76,11 @@ class FaqsController extends Controller
* @param \App\Models\Faqs\Faq $faq
* @param \App\Http\Requests\Backend\Faqs\EditFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\Backend\Faq\EditResponse
*/
public function edit(Faq $faq, EditFaqsRequest $request)
{
return view('backend.faqs.edit')
->with('faq', $faq);
return new EditResponse($faq);
}
/**
......@@ -86,17 +89,13 @@ class FaqsController extends Controller
* @param \App\Http\Requests\Backend\Faqs\UpdateFaqsRequest $request
* @param \App\Models\Faqs\Faq $id
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function update(UpdateFaqsRequest $request, Faq $faq)
{
$input = $request->all();
$this->faq->update($faq, $input);
$this->faq->update($faq, $request->all());
return redirect()
->route('admin.faqs.index')
->with('flash_success', trans('alerts.backend.faqs.updated'));
return new RedirectResponse(route('admin.faqs.index'), ['flash_success' => trans('alerts.backend.faqs.updated')]);
}
/**
......@@ -105,14 +104,12 @@ class FaqsController extends Controller
* @param \App\Models\Faqs\Faq $faq
* @param \App\Http\Requests\Backend\Faqs\DeleteFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Faq $faq, DeleteFaqsRequest $request)
{
$this->faq->delete($faq);
return redirect()
->route('admin.faqs.index')
->with('flash_success', trans('alerts.backend.faqs.deleted'));
return new RedirectResponse(route('admin.faqs.index'), ['flash_success' => trans('alerts.backend.faqs.deleted')]);
}
}
......@@ -9,20 +9,50 @@ use App\Http\Requests\Backend\Menu\EditMenuRequest;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Http\Requests\Backend\Menu\StoreMenuRequest;
use App\Http\Requests\Backend\Menu\UpdateMenuRequest;
use App\Http\Responses\Backend\Menu\CreateResponse;
use App\Http\Responses\Backend\Menu\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\Menu\Menu;
use App\Repositories\Backend\Menu\MenuRepository;
use Illuminate\Support\Facades\DB;
use Bvipul\Generator\Module;
class MenuController extends Controller
{
/**
* Menu Model Object.
*
* @var \App\Models\Menu\Menu
*/
protected $menu;
/**
* Module Model Object.
*
* @var \Bvipul\Generator\Module
*/
protected $modules;
/**
* Menu Types.
*
* @var array
*/
protected $types;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menu
*/
public function __construct(MenuRepository $menu)
public function __construct(MenuRepository $menu, Module $module)
{
$this->menu = $menu;
$this->modules = $module;
$this->types = [
'backend' => 'Backend',
'frontend' => 'Frontend',
];
}
/**
......@@ -30,11 +60,11 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageMenuRequest $request)
{
return view('backend.menus.index');
return new ViewResponse('backend.menus.index');
}
/**
......@@ -42,17 +72,11 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\Backend\Menu\CreateResponse
*/
public function create(CreateMenuRequest $request)
{
$types = [
'backend' => 'Backend',
'frontend' => 'Frontend',
];
$modules = DB::table('modules')->get();
return view('backend.menus.create')->withTypes($types)->withModules($modules);
return new CreateResponse($this->types, $this->modules);
}
/**
......@@ -60,13 +84,13 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreMenuRequest $request)
{
$this->menu->create($request->except('_token'));
return redirect()->route('admin.menus.index')->withFlashSuccess(trans('alerts.backend.menus.created'));
return new RedirectResponse(route('admin.menus.index'), ['flash_success' => trans('alerts.backend.menus.created')]);
}
/**
......@@ -75,21 +99,11 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\Backend\Menu\EditResponse
*/
public function edit(Menu $menu, EditMenuRequest $request)
{
$types = [
'backend' => 'Backend',
'frontend' => 'Frontend',
];
$modules = DB::table('modules')->get();
return view('backend.menus.edit')
->with('types', $types)
->with('menu', $menu)
->with('modules', $modules);
return new EditResponse($menu, $this->types, $this->modules);
}
/**
......@@ -98,15 +112,13 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\UpdateMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Menu $menu, UpdateMenuRequest $request)
{
$this->menu->update($menu, $request->all());
return redirect()
->route('admin.menus.index')
->with('flash_success', trans('alerts.backend.menus.updated'));
return new RedirectResponse(route('admin.menus.index'), ['flash_success' => trans('alerts.backend.menus.updated')]);
}
/**
......@@ -115,14 +127,12 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Menu $menu, DeleteMenuRequest $request)
{
$this->menu->delete($menu);
return redirect()
->route('admin.menus.index')
->with('flash_success', trans('alerts.backend.menus.deleted'));
return new RedirectResponse(route('admin.menus.index'), ['flash_success' => trans('alerts.backend.menus.deleted')]);
}
}
......@@ -9,6 +9,9 @@ use App\Http\Requests\Backend\Pages\EditPageRequest;
use App\Http\Requests\Backend\Pages\ManagePageRequest;
use App\Http\Requests\Backend\Pages\StorePageRequest;
use App\Http\Requests\Backend\Pages\UpdatePageRequest;
use App\Http\Responses\Backend\Page\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\ViewResponse;
use App\Models\Page\Page;
use App\Repositories\Backend\Pages\PagesRepository;
......@@ -30,70 +33,69 @@ class PagesController extends Controller
/**
* @param \App\Http\Requests\Backend\Pages\ManagePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManagePageRequest $request)
{
return view('backend.pages.index');
return new ViewResponse('backend.pages.index');
}
/**
* @param \App\Http\Requests\Backend\Pages\CreatePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreatePageRequest $request)
{
return view('backend.pages.create');
return new ViewResponse('backend.pages.create');
}
/**
* @param \App\Http\Requests\Backend\Pages\StorePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StorePageRequest $request)
{
$this->pages->create($request->except(['_token']));
return redirect()->route('admin.pages.index')->withFlashSuccess(trans('alerts.backend.pages.created'));
return new RedirectResponse(route('admin.pages.index'), ['flash_success' => trans('alerts.backend.pages.created')]);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\EditPageRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Page\EditResponse
*/
public function edit(Page $page, EditPageRequest $request)
{
return view('backend.pages.edit')
->withPage($page);
return new EditResponse($page);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\UpdatePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Page $page, UpdatePageRequest $request)
{
$this->pages->update($page, $request->except(['_method', '_token']));
return redirect()->route('admin.pages.index')->withFlashSuccess(trans('alerts.backend.pages.updated'));
return new RedirectResponse(route('admin.pages.index'), ['flash_success' => trans('alerts.backend.pages.updated')]);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\DeletePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Page $page, DeletePageRequest $request)
{
$this->pages->delete($page);
return redirect()->route('admin.pages.index')->withFlashSuccess(trans('alerts.backend.pages.deleted'));
return new RedirectResponse(route('admin.pages.index'), ['flash_success' => trans('alerts.backend.pages.deleted')]);
}
}
......@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Backend\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Settings\ManageSettingsRequest;
use App\Http\Requests\Backend\Settings\UpdateSettingsRequest;
use App\Http\Responses\Backend\Setting\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Models\Settings\Setting;
use App\Repositories\Backend\Settings\SettingsRepository;
......@@ -27,26 +29,23 @@ class SettingsController extends Controller
* @param \App\Models\Settings\Setting $setting
* @param \App\Http\Requests\Backend\Settings\ManageSettingsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Setting\EditResponse
*/
public function edit(Setting $setting, ManageSettingsRequest $request)
{
return view('backend.settings.edit')
->withSetting($setting);
return new EditResponse($setting);
}
/**
* @param \App\Models\Settings\Setting $setting
* @param \App\Http\Requests\Backend\Settings\UpdateSettingsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Setting $setting, UpdateSettingsRequest $request)
{
$this->settings->update($setting, $request->except(['_token', '_method']));
return redirect()
->route('admin.settings.edit', $setting->id)
->with('flash_success', trans('alerts.backend.settings.updated'));
return new RedirectResponse(route('admin.settings.edit', $setting->id), ['flash_success' => trans('alerts.backend.settings.updated')]);
}
}
......@@ -3,6 +3,7 @@
namespace App\Http\Middleware;
use Closure;
use Cookie;
use Illuminate\Session\Store;
/**
......@@ -39,7 +40,10 @@ class SessionTimeout
*/
public function handle($request, Closure $next)
{
if (config('session.timeout_status')) {
//Cookie Name for when 'remember me' is checked
$remember_cookie = \Auth::guard()->getRecallerName();
if (!Cookie::has($remember_cookie) && config('session.timeout_status')) {
$isLoggedIn = $request->path() != '/logout';
if (!session('lastActivityTime')) {
......
<?php
namespace App\Http\Responses\Backend\Access\Permission;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
/**
* @var \App\Repositories\Backend\Access\Permission\PermissionRepository
*/
protected $permissions;
/**
* @param \App\Repositories\Backend\Access\Permission\PermissionRepository $permissions
*/
public function __construct($permissions)
{
$this->permissions = $permissions;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.permissions.create')
->withPermissionCount($this->permissions->getCount());
}
}
<?php
namespace App\Http\Responses\Backend\Access\Permission;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Access\Permission\Permission
*/
protected $permission;
/**
* @param \App\Models\Access\Permission\Permission $permission
*/
public function __construct($permission)
{
$this->permission = $permission;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.permissions.edit')
->withPermission($this->permission);
}
}
<?php
namespace App\Http\Responses\Backend\Access\Role;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
/**
* @var \App\Repositories\Backend\Access\Role\RoleRepository
*/
protected $roles;
/**
* @var \App\Repositories\Backend\Access\Permission\PermissionRepository
*/
protected $permissions;
/**
* @param \App\Repositories\Backend\Access\Permission\PermissionRepository $permissions
* @param \App\Repositories\Backend\Access\Role\RoleRepository $roles
*/
public function __construct($permissions, $roles)
{
$this->permissions = $permissions;
$this->roles = $roles;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.roles.create')
->withPermissions($this->permissions->getAll())
->withRoleCount($this->roles->getCount());
}
}
<?php
namespace App\Http\Responses\Backend\Access\Role;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Access\Role\Role
*/
protected $role;
/**
* @var \App\Repositories\Backend\Access\Permission\PermissionRepository
*/
protected $permissions;
/**
* @param \App\Models\Access\Role\Role $role
* @param \App\Repositories\Backend\Access\Permission\PermissionRepository $permissions
*/
public function __construct($role, $permissions)
{
$this->role = $role;
$this->permissions = $permissions;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.roles.edit')
->withRole($this->role)
->withRolePermissions($this->role->permissions->pluck('id')->all())
->withPermissions($this->permissions->getAll());
}
}
<?php
namespace App\Http\Responses\Backend\Access\User;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
/**
* @var \App\Models\Access\Role\Role
*/
protected $roles;
/**
* @param \Illuminate\Database\Eloquent\Collection $roles
*/
public function __construct($roles)
{
$this->roles = $roles;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.users.create')->with([
'roles' => $this->roles,
]);
}
}
<?php
namespace App\Http\Responses\Backend\Access\User;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Access\User\User
*/
protected $user;
/**
* @var \App\Models\Access\Permission\Permission
*/
protected $permissions;
/**
* @var \App\Models\Access\Role\Role
*/
protected $roles;
/**
* @param \App\Models\Access\User\User $user
*/
public function __construct($user, $roles, $permissions)
{
$this->user = $user;
$this->roles = $roles;
$this->permissions = $permissions;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
$permissions = $this->permissions;
$userPermissions = $this->user->permissions()->get()->pluck('id')->toArray();
return view('backend.access.users.edit')->with([
'user' => $this->user,
'userRoles' => $this->user->roles->pluck('id')->all(),
'roles' => $this->roles,
'userPermissions' => $userPermissions,
'permissions' => $permissions,
]);
}
}
<?php
namespace App\Http\Responses\Backend\Access\User;
use Illuminate\Contracts\Support\Responsable;
class ShowResponse implements Responsable
{
/**
* @var \App\Models\Access\User\User
*/
protected $user;
/**
* @param \App\Models\Access\User\User $user
*/
public function __construct($user)
{
$this->user = $user;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.users.show')->withUser($this->user);
}
}
<?php
namespace App\Http\Responses\Backend\Blog;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
protected $status;
protected $blogTags;
protected $blogCategories;
public function __construct($status, $blogCategories, $blogTags)
{
$this->status = $status;
$this->blogTags = $blogTags;
$this->blogCategories = $blogCategories;
}
public function toResponse($request)
{
return view('backend.blogs.create')->with([
'blogCategories' => $this->blogCategories,
'blogTags' => $this->blogTags,
'status' => $this->status,
]);
}
}
<?php
namespace App\Http\Responses\Backend\Blog;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
protected $blog;
protected $status;
protected $blogTags;
protected $blogCategories;
public function __construct($blog, $status, $blogCategories, $blogTags)
{
$this->blog = $blog;
$this->status = $status;
$this->blogTags = $blogTags;
$this->blogCategories = $blogCategories;
}
public function toResponse($request)
{
$selectedCategories = $this->blog->categories->pluck('id')->toArray();
$selectedtags = $this->blog->tags->pluck('id')->toArray();
return view('backend.blogs.edit')->with([
'blog' => $this->blog,
'blogCategories' => $this->blogCategories,
'blogTags' => $this->blogTags,
'selectedCategories' => $selectedCategories,
'selectedtags' => $selectedtags,
'status' => $this->status,
]);
}
}
<?php
namespace App\Http\Responses\Backend\Blog;
use Illuminate\Contracts\Support\Responsable;
class IndexResponse implements Responsable
{
protected $status;
public function __construct($status)
{
$this->status = $status;
}
public function toResponse($request)
{
return view('backend.blogs.index')->with([
'status'=> $this->status,
]);
}
}
<?php
namespace App\Http\Responses\Backend\Menu;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\BlogCategories\BlogCategory
*/
protected $blogCategory;
/**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory
*/
public function __construct($blogCategory, $types, $modules)
{
$this->blogCategory = $blogCategory;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.blogcategories.edit')
->with('blogcategory', $this->blogCategory);
}
}
<?php
namespace App\Http\Responses\Backend\BlogTag;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\BlogTags\BlogTag
*/
protected $blogTag;
/**
* @param \App\Models\BlogTags\BlogTag $blogTag
*/
public function __construct($blogTag)
{
$this->blogTag = $blogTag;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.blogtags.edit')
->with('blogtag', $this->blogTag);
}
}
<?php
namespace App\Http\Responses\Backend\Faq;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Faqs\Faq
*/
protected $faq;
/**
* @param \App\Models\Faqs\Faq $faq
*/
public function __construct($faq)
{
$this->faq = $faq;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.faqs.edit')
->with('faq', $this->faq);
}
}
<?php
namespace App\Http\Responses\Backend\Menu;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
/**
* @var array
*/
protected $types;
/**
* @var \Bvipul\Generator\Module
*/
protected $modules;
/**
* @param array $types
* @param \Bvipul\Generator\Module $modules
*/
public function __construct($types, $modules)
{
$this->types = $types;
$this->modules = $modules;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.menus.create')
->withTypes($this->types)
->withModules($this->modules->all());
}
}
<?php
namespace App\Http\Responses\Backend\Menu;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var array
*/
protected $types;
/**
* @var \Bvipul\Generator\Module
*/
protected $modules;
/**
* @var \App\Models\Menu\Menu
*/
protected $menu;
/**
* @param \App\Models\Menu\Menu $menu
* @param array $types
* @param \Bvipul\Generator\Module $modules
*/
public function __construct($menu, $types, $modules)
{
$this->menu = $menu;
$this->types = $types;
$this->modules = $modules;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.menus.edit')
->with('types', $this->types)
->with('menu', $this->menu)
->with('modules', $this->modules->all());
}
}
<?php
namespace App\Http\Responses\Backend\Page;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Page\Page
*/
protected $page;
/**
* @param \App\Models\Page\Page $page
*/
public function __construct($page)
{
$this->page = $page;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.pages.edit')
->withPage($this->page);
}
}
<?php
namespace App\Http\Responses\Backend\Setting;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Settings\Setting
*/
protected $setting;
/**
* @param \App\Models\Settings\Setting $setting
*/
public function __construct($setting)
{
$this->setting = $setting;
}
/**
* toReponse.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.settings.edit')
->withSetting($this->setting);
}
}
<?php
namespace App\Http\Responses;
use Illuminate\Contracts\Support\Responsable;
class RedirectResponse implements Responsable
{
protected $route;
protected $message;
public function __construct($route, $message)
{
$this->route = $route;
$this->message = $message;
}
public function toResponse($request)
{
return redirect()
->to($this->route)
->with($this->message);
}
}
<?php
namespace App\Http\Responses;
use Illuminate\Contracts\Support\Responsable;
class ViewResponse implements Responsable
{
/**
* @var string
*/
protected $view;
/**
* @var array
*/
protected $with;
/**
* @param string $view
* @param array $with
*/
public function __construct($view, $with = [])
{
$this->view = $view;
$this->with = $with;
}
/**
* In Response.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
if (!empty($this->with)) {
return view($this->view)->with($this->with);
}
return view($this->view);
}
}
<?php
namespace App\Providers;
use App\Helpers\Macros\Macros;
use Collective\Html\HtmlServiceProvider;
/**
* Class MacroServiceProvider.
*/
class MacroServiceProvider extends HtmlServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
parent::register();
$this->app->singleton('form', function ($app) {
$form = new Macros($app['html'], $app['url'], $app['view'], $app['session.store']->token());
return $form->setSessionStore($app['session.store']);
});
}
}
This diff is collapsed.
......@@ -198,7 +198,6 @@ return [
App\Providers\ComposerServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\HistoryServiceProvider::class,
App\Providers\MacroServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
Bvipul\Generator\Provider\CrudGeneratorServiceProvider::class,
......
......@@ -56,7 +56,7 @@ return [
*/
'from' => [
'address' => env('MAIL_USERNAME', 'viral.solani@gmail.com'),
'address' => env('MAIL_FROM', 'viral.solani@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Admin'),
],
......
FROM ubuntu:16.04
RUN apt-get update \
&& apt-get install -qy language-pack-en-base \
&& locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get -y install apache2
RUN a2enmod headers
RUN a2enmod rewrite
# add PPA for PHP 7
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt update
RUN apt -y dist-upgrade
RUN apt remove --purge ca-certificates
RUN apt autoremove
RUN apt install ca-certificates
RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository -y ppa:ondrej/php
# Adding php 7
RUN apt-get update
RUN apt-get install -y php7.1 php7.1-fpm php7.1-cli php7.1-common php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-mysql php7.1-mcrypt php7.1-zip
RUN apt-get -y install libapache2-mod-php7.1 php7.1 php7.1-cli php-xdebug php7.1-mbstring sqlite3 php7.1-mysql php-imagick php-memcached php-pear curl imagemagick php7.1-dev php7.1-phpdbg php7.1-gd npm nodejs-legacy php7.1-json php7.1-curl php7.1-sqlite3 php7.1-intl apache2 vim git-core wget libsasl2-dev libssl-dev
RUN apt-get -y install libsslcommon2-dev libcurl4-openssl-dev autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev
RUN apt-get install -y imagemagick graphicsmagick
RUN a2enmod headers
RUN a2enmod rewrite
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
ln -sf /dev/stderr /var/log/apache2/error.log
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR
# Update application repository list and install the Redis server.
#RUN apt-get update && apt-get install -y redis-server
# Allow Composer to be run as root
ENV COMPOSER_ALLOW_SUPERUSER 1
# Setup the Composer installer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
&& php /tmp/composer-setup.php \
&& chmod a+x composer.phar \
&& mv composer.phar /usr/local/bin/composer
# Install composer dependencies
RUN echo pwd: `pwd` && echo ls: `ls`
# RUN composer install
EXPOSE 80
# Expose default port
#EXPOSE 6379
VOLUME [ "/var/www/html" ,"/etc/mysql"]
WORKDIR /var/www/html
ENTRYPOINT [ "/usr/sbin/apache2" ]
CMD ["-D", "FOREGROUND"]
COPY . /var/www/html
COPY ./deploy/vhost.conf /etc/apache2/sites-available/000-default.conf
RUN chown -R www-data:www-data /var/www/html \
&& a2enmod rewrite
RUN chown -R 777 /var/www/html/
RUN composer install
RUN php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
<VirtualHost *:80>
DocumentRoot /var/www/html/public
<Directory "/var/www/html/public">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
\ No newline at end of file
version: '3'
services:
app:
image: inshastri/laravel-adminpanel:latest
ports:
- 80:80
- 8080:8080
links:
- mysql
- redis
environment:
DB_HOST: mysql
DB_DATABASE: laravel_docker
DB_USERNAME: root
DB_PASSWORD: toor
REDIS_HOST: redis
SESSION_DRIVER: redis
CACHE_DRIVER: redis
networks:
- testservice_bridge2
mysql:
image: mysql:5
volumes:
- ./data:/var/lib/mysql
ports:
- 3306:3306
restart: always
environment:
MYSQL_ROOT_PASSWORD: toor
MYSQL_DATABASE: laravel_docker
networks:
- testservice_bridge2
redis:
image: redis:4.0-alpine
ports:
- 6379:6379
networks:
- testservice_bridge2
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_PORT: 3306
PMA_HOST: mysql
PMA_USER: root
PMA_PASSWORD: toor
ports:
- "8005:80"
restart: always
depends_on:
- mysql
networks:
- testservice_bridge2
networks:
testservice_bridge2:
This diff is collapsed.
This diff is collapsed.
<template>
<div class="btn-group">
<button type="button" class="btn btn-warning btn-flat dropdown-toggle" data-toggle="dropdown">Export
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li id="copyButton"><a href="#"><i class="fa fa-clone"></i> Copy</a></li>
<li id="csvButton"><a href="#"><i class="fa fa-file-text-o"></i> CSV</a></li>
<li id="excelButton"><a href="#"><i class="fa fa-file-excel-o"></i> Excel</a></li>
<li id="pdfButton"><a href="#"><i class="fa fa-file-pdf-o"></i> PDF</a></li>
<li id="printButton"><a href="#"><i class="fa fa-print"></i> Print</a></li>
</ul>
</div>
</template>
<script>
export default {
props: [],
data() {
return {};
}
};
</script>
<!--Action Button-->
@if(Active::checkUriPattern('admin/access/permission'))
<div class="btn-group">
<button type="button" class="btn btn-warning btn-flat dropdown-toggle" data-toggle="dropdown">Export
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li id="copyButton"><a href="#"><i class="fa fa-clone"></i> Copy</a></li>
<li id="csvButton"><a href="#"><i class="fa fa-file-text-o"></i> CSV</a></li>
<li id="excelButton"><a href="#"><i class="fa fa-file-excel-o"></i> Excel</a></li>
<li id="pdfButton"><a href="#"><i class="fa fa-file-pdf-o"></i> PDF</a></li>
<li id="printButton"><a href="#"><i class="fa fa-print"></i> Print</a></li>
</ul>
</div>
@endif
@if(Active::checkUriPattern('admin/access/permission'))
<export-component></export-component>
@endif
<!--Action Button-->
<div class="btn-group">
<button type="button" class="btn btn-primary btn-flat dropdown-toggle" data-toggle="dropdown">Action
......
<!--Action Button-->
@if(Active::checkUriPattern('admin/blogCategories'))
<div class="btn-group">
<button type="button" class="btn btn-warning btn-flat dropdown-toggle" data-toggle="dropdown">Export
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li id="copyButton"><a href="#"><i class="fa fa-clone"></i> Copy</a></li>
<li id="csvButton"><a href="#"><i class="fa fa-file-text-o"></i> CSV</a></li>
<li id="excelButton"><a href="#"><i class="fa fa-file-excel-o"></i> Excel</a></li>
<li id="pdfButton"><a href="#"><i class="fa fa-file-pdf-o"></i> PDF</a></li>
<li id="printButton"><a href="#"><i class="fa fa-print"></i> Print</a></li>
</ul>
</div>
@endif
@if(Active::checkUriPattern('admin/blogCategories'))
<export-component></export-component>
@endif
<!--Action Button-->
<div class="btn-group">
<button type="button" class="btn btn-primary btn-flat dropdown-toggle" data-toggle="dropdown">Action
......
......@@ -12,7 +12,7 @@
<h3 class="box-title">{{ trans('labels.backend.faqs.management') }}</h3>
<div class="box-tools pull-right">
@include('backend.includes.partials.faqs-header-buttons')
@include('backend.faqs.partials.faqs-header-buttons')
</div>
</div><!-- /.box-header -->
......
......@@ -16,7 +16,6 @@ class ManageBlogCategoriesTest extends TestCase
->assertSee(trans('labels.backend.blogcategories.management'))
->assertSee(trans('labels.backend.blogcategories.table.title'))
->assertSee(trans('labels.backend.blogcategories.table.status'))
->assertSee('Export')
->assertSee('Action');
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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