Commit 374d9bd1 authored by bvipul's avatar bvipul

pulled develop

parents 5d431e69 d24e4825
...@@ -21,6 +21,11 @@ CACHE_DRIVER=file ...@@ -21,6 +21,11 @@ CACHE_DRIVER=file
SESSION_DRIVER=file SESSION_DRIVER=file
QUEUE_DRIVER=sync QUEUE_DRIVER=sync
#Session Timeout
SESSION_TIMEOUT_STATUS=true
#In Seconds
SESSION_TIMEOUT=600
REDIS_HOST=127.0.0.1 REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null REDIS_PASSWORD=null
REDIS_PORT=6379 REDIS_PORT=6379
......
...@@ -2,16 +2,20 @@ ...@@ -2,16 +2,20 @@
namespace App\Http\Controllers\Backend\Access\Role; namespace App\Http\Controllers\Backend\Access\Role;
use App\Models\Access\Role\Role;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\Backend\Access\Role\EditResponse;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Http\Requests\Backend\Access\Role\EditRoleRequest;
use App\Http\Responses\Backend\Access\Role\CreateResponse;
use App\Http\Requests\Backend\Access\Role\StoreRoleRequest;
use App\Http\Requests\Backend\Access\Role\CreateRoleRequest; use App\Http\Requests\Backend\Access\Role\CreateRoleRequest;
use App\Http\Requests\Backend\Access\Role\DeleteRoleRequest; use App\Http\Requests\Backend\Access\Role\DeleteRoleRequest;
use App\Http\Requests\Backend\Access\Role\EditRoleRequest;
use App\Http\Requests\Backend\Access\Role\ManageRoleRequest; 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\Requests\Backend\Access\Role\UpdateRoleRequest;
use App\Models\Access\Role\Role;
use App\Repositories\Backend\Access\Permission\PermissionRepository; use App\Repositories\Backend\Access\Permission\PermissionRepository;
use App\Repositories\Backend\Access\Role\RoleRepository;
/** /**
* Class RoleController. * Class RoleController.
...@@ -19,18 +23,18 @@ use App\Repositories\Backend\Access\Role\RoleRepository; ...@@ -19,18 +23,18 @@ use App\Repositories\Backend\Access\Role\RoleRepository;
class RoleController extends Controller class RoleController extends Controller
{ {
/** /**
* @var RoleRepository * @var \App\Repositories\Backend\Access\Role\RoleRepository
*/ */
protected $roles; protected $roles;
/** /**
* @var PermissionRepository * @var \App\Repositories\Backend\Access\Permission\PermissionRepository
*/ */
protected $permissions; protected $permissions;
/** /**
* @param RoleRepository $roles * @param \App\Repositories\Backend\Access\Role\RoleRepository $roles
* @param PermissionRepository $permissions * @param \App\Repositories\Backend\Access\Permission\PermissionRepository $permissions
*/ */
public function __construct(RoleRepository $roles, PermissionRepository $permissions) public function __construct(RoleRepository $roles, PermissionRepository $permissions)
{ {
...@@ -39,76 +43,71 @@ class RoleController extends Controller ...@@ -39,76 +43,71 @@ class RoleController extends Controller
} }
/** /**
* @param ManageRoleRequest $request * @param \App\Http\Requests\Backend\Access\Role\ManageRoleRequest $request
* *
* @return mixed * @return mixed
*/ */
public function index(ManageRoleRequest $request) 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) public function create(CreateRoleRequest $request)
{ {
return view('backend.access.roles.create') return new CreateResponse($this->permissions, $this->roles);
->withPermissions($this->permissions->getAll())
->withRoleCount($this->roles->getCount());
} }
/** /**
* @param StoreRoleRequest $request * @param \App\Http\Requests\Backend\Access\Role\StoreRoleRequest $request
* *
* @return mixed * @return \App\Http\Responses\RedirectResponse
*/ */
public function store(StoreRoleRequest $request) public function store(StoreRoleRequest $request)
{ {
$this->roles->create($request->all()); $this->roles->create($request->all());
return redirect()->route('admin.access.role.index')->withFlashSuccess(trans('alerts.backend.roles.created')); return new RedirectResponse('admin.access.role.index', ['flash_success' => trans('alerts.backend.roles.created')]);
} }
/** /**
* @param Role $role * @param \App\Models\Access\Role\Role $role
* @param EditRoleRequest $request * @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) public function edit(Role $role, EditRoleRequest $request)
{ {
return view('backend.access.roles.edit') return new EditResponse($role, $this->permissions);
->withRole($role)
->withRolePermissions($role->permissions->pluck('id')->all())
->withPermissions($this->permissions->getAll());
} }
/** /**
* @param Role $role * @param \App\Models\Access\Role\Role $role
* @param UpdateRoleRequest $request * @param \App\Http\Requests\Backend\Access\Role\UpdateRoleRequest $request
* *
* @return mixed * @return \App\Http\Responses\RedirectResponse
*/ */
public function update(Role $role, UpdateRoleRequest $request) public function update(Role $role, UpdateRoleRequest $request)
{ {
$this->roles->update($role, $request->all()); $this->roles->update($role, $request->all());
return redirect()->route('admin.access.role.index')->withFlashSuccess(trans('alerts.backend.roles.updated')); return new RedirectResponse('admin.access.role.index', ['flash_success' => trans('alerts.backend.roles.updated')]);
} }
/** /**
* @param Role $role * @param \App\Models\Access\Role\Role $role
* @param DeleteRoleRequest $request * @param \App\Http\Requests\Backend\Access\Role\DeleteRoleRequest $request
* *
* @return mixed * @return \App\Http\Responses\RedirectResponse
*/ */
public function destroy(Role $role, DeleteRoleRequest $request) public function destroy(Role $role, DeleteRoleRequest $request)
{ {
$this->roles->delete($role); $this->roles->delete($role);
return redirect()->route('admin.access.role.index')->withFlashSuccess(trans('alerts.backend.roles.deleted')); return new RedirectResponse('admin.access.role.index', ['flash_success' => trans('alerts.backend.roles.deleted')]);
} }
} }
...@@ -2,18 +2,23 @@ ...@@ -2,18 +2,23 @@
namespace App\Http\Controllers\Backend\Access\User; namespace App\Http\Controllers\Backend\Access\User;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Access\User\CreateUserRequest; use App\Http\Responses\ViewResponse;
use App\Http\Requests\Backend\Access\User\DeleteUserRequest; use App\Http\Responses\RedirectResponse;
use App\Models\Access\Permission\Permission;
use App\Http\Responses\Backend\Access\User\EditResponse;
use App\Http\Responses\Backend\Access\User\ShowResponse;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Repositories\Backend\Access\User\UserRepository;
use App\Http\Requests\Backend\Access\User\EditUserRequest; use App\Http\Requests\Backend\Access\User\EditUserRequest;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Http\Requests\Backend\Access\User\ShowUserRequest; use App\Http\Requests\Backend\Access\User\ShowUserRequest;
use App\Http\Responses\Backend\Access\User\CreateResponse;
use App\Http\Requests\Backend\Access\User\StoreUserRequest; use App\Http\Requests\Backend\Access\User\StoreUserRequest;
use App\Http\Requests\Backend\Access\User\CreateUserRequest;
use App\Http\Requests\Backend\Access\User\DeleteUserRequest;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Http\Requests\Backend\Access\User\UpdateUserRequest; use App\Http\Requests\Backend\Access\User\UpdateUserRequest;
use App\Models\Access\Permission\Permission;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Repositories\Backend\Access\User\UserRepository;
/** /**
* Class UserController. * Class UserController.
...@@ -21,18 +26,18 @@ use App\Repositories\Backend\Access\User\UserRepository; ...@@ -21,18 +26,18 @@ use App\Repositories\Backend\Access\User\UserRepository;
class UserController extends Controller class UserController extends Controller
{ {
/** /**
* @var UserRepository * @var \App\Repositories\Backend\Access\User\UserRepository
*/ */
protected $users; protected $users;
/** /**
* @var RoleRepository * @var \App\Repositories\Backend\Access\Role\RoleRepository
*/ */
protected $roles; protected $roles;
/** /**
* @param UserRepository $users * @param \App\Repositories\Backend\Access\User\UserRepository $users
* @param RoleRepository $roles * @param \App\Repositories\Backend\Access\Role\RoleRepository $roles
*/ */
public function __construct(UserRepository $users, RoleRepository $roles) public function __construct(UserRepository $users, RoleRepository $roles)
{ {
...@@ -41,94 +46,87 @@ class UserController extends Controller ...@@ -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) 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) 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) public function store(StoreUserRequest $request)
{ {
$this->users->create($request); $this->users->create($request);
return redirect()->route('admin.access.user.index')->withFlashSuccess(trans('alerts.backend.users.created')); return new RedirectResponse('admin.access.user.index', ['flash_success' => trans('alerts.backend.users.created')]);
} }
/** /**
* @param User $user * @param \App\Models\Access\User\User $user
* @param ShowUserRequest $request * @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) public function show(User $user, ShowUserRequest $request)
{ {
return view('backend.access.users.show') return new ShowResponse($user);
->withUser($user);
} }
/** /**
* @param User $user * @param \App\Models\Access\User\User $user
* @param EditUserRequest $request * @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) public function edit(User $user, EditUserRequest $request)
{ {
$roles = $this->roles->getAll();
$permissions = Permission::getSelectData('display_name'); $permissions = Permission::getSelectData('display_name');
$userPermissions = $user->permissions()->get()->pluck('id')->toArray();
return new EditResponse($user, $roles, $permissions);
return view('backend.access.users.edit')->with([
'user' => $user,
'userRoles' => $user->roles->pluck('id')->all(),
'roles' => $this->roles->getAll(),
'userPermissions' => $userPermissions,
'permissions' => $permissions,
]);
} }
/** /**
* @param User $user * @param \App\Models\Access\User\User $user
* @param UpdateUserRequest $request * @param \App\Http\Requests\Backend\Access\User\UpdateUserRequest $request
* *
* @return mixed * @return \App\Http\Responses\RedirectResponse
*/ */
public function update(User $user, UpdateUserRequest $request) public function update(User $user, UpdateUserRequest $request)
{ {
$this->users->update($user, $request); $this->users->update($user, $request);
return redirect()->route('admin.access.user.index')->withFlashSuccess(trans('alerts.backend.users.updated')); return new RedirectResponse('admin.access.user.index', ['flash_success' => trans('alerts.backend.users.updated')]);
} }
/** /**
* @param User $user * @param \App\Models\Access\User\User $user
* @param DeleteUserRequest $request * @param \App\Http\Requests\Backend\Access\User\DeleteUserRequest $request
* *
* @return mixed * @return \App\Http\Responses\RedirectResponse
*/ */
public function destroy(User $user, DeleteUserRequest $request) public function destroy(User $user, DeleteUserRequest $request)
{ {
$this->users->delete($user); $this->users->delete($user);
return redirect()->route('admin.access.user.deleted')->withFlashSuccess(trans('alerts.backend.users.deleted')); return new RedirectResponse('admin.access.user.index', ['flash_success' => trans('alerts.backend.users.deleted')]);
} }
} }
...@@ -14,12 +14,12 @@ use Yajra\DataTables\Facades\DataTables; ...@@ -14,12 +14,12 @@ use Yajra\DataTables\Facades\DataTables;
class UserTableController extends Controller class UserTableController extends Controller
{ {
/** /**
* @var UserRepository * @var \App\Repositories\Backend\Access\User\UserRepository
*/ */
protected $users; protected $users;
/** /**
* @param UserRepository $users * @param \App\Repositories\Backend\Access\User\UserRepository $users
*/ */
public function __construct(UserRepository $users) public function __construct(UserRepository $users)
{ {
...@@ -27,7 +27,7 @@ class UserTableController extends Controller ...@@ -27,7 +27,7 @@ class UserTableController extends Controller
} }
/** /**
* @param ManageUserRequest $request * @param \App\Http\Requests\Backend\Access\User\ManageUserRequest $request
* *
* @return mixed * @return mixed
*/ */
......
...@@ -6,9 +6,9 @@ use App\Http\Controllers\Controller; ...@@ -6,9 +6,9 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Blogs\ManageBlogsRequest; use App\Http\Requests\Backend\Blogs\ManageBlogsRequest;
use App\Http\Requests\Backend\Blogs\StoreBlogsRequest; use App\Http\Requests\Backend\Blogs\StoreBlogsRequest;
use App\Http\Requests\Backend\Blogs\UpdateBlogsRequest; use App\Http\Requests\Backend\Blogs\UpdateBlogsRequest;
use App\Http\Responses\Backend\Blog\IndexResponse;
use App\Http\Responses\Backend\Blog\CreateResponse; use App\Http\Responses\Backend\Blog\CreateResponse;
use App\Http\Responses\Backend\Blog\EditResponse; use App\Http\Responses\Backend\Blog\EditResponse;
use App\Http\Responses\Backend\Blog\IndexResponse;
use App\Http\Responses\RedirectResponse; use App\Http\Responses\RedirectResponse;
use App\Models\BlogCategories\BlogCategory; use App\Models\BlogCategories\BlogCategory;
use App\Models\Blogs\Blog; use App\Models\Blogs\Blog;
...@@ -89,7 +89,7 @@ class BlogsController extends Controller ...@@ -89,7 +89,7 @@ class BlogsController extends Controller
$blogCategories = BlogCategory::getSelectData(); $blogCategories = BlogCategory::getSelectData();
$blogTags = BlogTag::getSelectData(); $blogTags = BlogTag::getSelectData();
return new EditResponse($blog, $this->status, $blogCategories, $blogTags); return new EditResponse($blog, $this->status, $blogCategories, $blogTags);
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Closure; use Closure;
use Cookie;
use Illuminate\Session\Store; use Illuminate\Session\Store;
/** /**
...@@ -39,7 +40,10 @@ class SessionTimeout ...@@ -39,7 +40,10 @@ class SessionTimeout
*/ */
public function handle($request, Closure $next) 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'; $isLoggedIn = $request->path() != '/logout';
if (!session('lastActivityTime')) { if (!session('lastActivityTime')) {
......
<?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 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\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);
}
}
...@@ -6,9 +6,9 @@ use Illuminate\Contracts\Support\Responsable; ...@@ -6,9 +6,9 @@ use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable class CreateResponse implements Responsable
{ {
protected $status, protected $status;
$blogTags, protected $blogTags;
$blogCategories; protected $blogCategories;
public function __construct($status, $blogCategories, $blogTags) public function __construct($status, $blogCategories, $blogTags)
{ {
...@@ -16,8 +16,8 @@ class CreateResponse implements Responsable ...@@ -16,8 +16,8 @@ class CreateResponse implements Responsable
$this->blogTags = $blogTags; $this->blogTags = $blogTags;
$this->blogCategories = $blogCategories; $this->blogCategories = $blogCategories;
} }
public function toResponse($request) public function toResponse($request)
{ {
return view('backend.blogs.create')->with([ return view('backend.blogs.create')->with([
'blogCategories' => $this->blogCategories, 'blogCategories' => $this->blogCategories,
...@@ -25,5 +25,4 @@ class CreateResponse implements Responsable ...@@ -25,5 +25,4 @@ class CreateResponse implements Responsable
'status' => $this->status, 'status' => $this->status,
]); ]);
} }
}
}
\ No newline at end of file
...@@ -6,10 +6,10 @@ use Illuminate\Contracts\Support\Responsable; ...@@ -6,10 +6,10 @@ use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable class EditResponse implements Responsable
{ {
protected $blog, protected $blog;
$status, protected $status;
$blogTags, protected $blogTags;
$blogCategories; protected $blogCategories;
public function __construct($blog, $status, $blogCategories, $blogTags) public function __construct($blog, $status, $blogCategories, $blogTags)
{ {
...@@ -18,8 +18,8 @@ class EditResponse implements Responsable ...@@ -18,8 +18,8 @@ class EditResponse implements Responsable
$this->blogTags = $blogTags; $this->blogTags = $blogTags;
$this->blogCategories = $blogCategories; $this->blogCategories = $blogCategories;
} }
public function toResponse($request) public function toResponse($request)
{ {
$selectedCategories = $this->blog->categories->pluck('id')->toArray(); $selectedCategories = $this->blog->categories->pluck('id')->toArray();
$selectedtags = $this->blog->tags->pluck('id')->toArray(); $selectedtags = $this->blog->tags->pluck('id')->toArray();
...@@ -33,5 +33,4 @@ class EditResponse implements Responsable ...@@ -33,5 +33,4 @@ class EditResponse implements Responsable
'status' => $this->status, 'status' => $this->status,
]); ]);
} }
}
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ namespace App\Http\Responses\Backend\Blog; ...@@ -4,7 +4,7 @@ namespace App\Http\Responses\Backend\Blog;
use Illuminate\Contracts\Support\Responsable; use Illuminate\Contracts\Support\Responsable;
class IndexResponse implements Responsable class IndexResponse implements Responsable
{ {
protected $status; protected $status;
...@@ -13,11 +13,10 @@ class IndexResponse implements Responsable ...@@ -13,11 +13,10 @@ class IndexResponse implements Responsable
$this->status = $status; $this->status = $status;
} }
public function toResponse($request) public function toResponse($request)
{ {
return view('backend.blogs.index')->with([ return view('backend.blogs.index')->with([
'status'=> $this->status, 'status'=> $this->status,
]); ]);
} }
}
}
\ No newline at end of file
...@@ -6,20 +6,19 @@ use Illuminate\Contracts\Support\Responsable; ...@@ -6,20 +6,19 @@ use Illuminate\Contracts\Support\Responsable;
class RedirectResponse implements Responsable class RedirectResponse implements Responsable
{ {
protected $route, protected $route;
$message; protected $message;
public function __construct($route, $message) public function __construct($route, $message)
{ {
$this->route = $route; $this->route = $route;
$this->message = $message; $this->message = $message;
} }
public function toResponse($request) public function toResponse($request)
{ {
return redirect() return redirect()
->route($this->route) ->route($this->route)
->with($this->message); ->with($this->message);
} }
}
}
\ No newline at end of file
<?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);
}
}
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 source diff could not be displayed because it is too large. You can view the blob instead.
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