Commit dd729881 authored by bvipul's avatar bvipul

Merge branch 'develop' of https://github.com/bvipul/laravel-adminpanel into develop

parents d1214bd4 9044ce45
......@@ -28,6 +28,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
......
......@@ -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\IndexResponse;
use App\Http\Responses\Backend\Blog\CreateResponse;
use App\Http\Responses\Backend\Blog\EditResponse;
use App\Http\Responses\RedirectResponse;
use App\Models\BlogCategories\BlogCategory;
use App\Models\Blogs\Blog;
use App\Models\BlogTags\BlogTag;
......@@ -46,9 +50,7 @@ class BlogsController extends Controller
*/
public function index(ManageBlogsRequest $request)
{
return view('backend.blogs.index')->with([
'status'=> $this->status,
]);
return new IndexResponse($this->status);
}
/**
......@@ -61,11 +63,7 @@ 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);
}
/**
......@@ -77,9 +75,7 @@ class BlogsController extends Controller
{
$this->blog->create($request->except('_token'));
return redirect()
->route('admin.blogs.index')
->with('flash_success', trans('alerts.backend.blogs.created'));
return new RedirectResponse('admin.blogs.index', ['flash_success' => trans('alerts.backend.blogs.created')]);
}
/**
......@@ -93,17 +89,7 @@ class BlogsController extends Controller
$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);
}
/**
......@@ -118,9 +104,7 @@ 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('admin.blogs.index', ['flash_success' => trans('alerts.backend.blogs.updated')]);
}
/**
......@@ -133,8 +117,6 @@ class BlogsController extends Controller
{
$this->blog->delete($blog);
return redirect()
->route('admin.blogs.index')
->with('flash_success', trans('alerts.backend.blogs.deleted'));
return new RedirectResponse('admin.blogs.index', ['flash_success' => trans('alerts.backend.blogs.deleted')]);
}
}
<?php
namespace App\Http\Responses\Backend\Blog;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
protected $status,
$blogTags,
$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,
]);
}
}
\ No newline at end of file
<?php
namespace App\Http\Responses\Backend\Blog;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
protected $blog,
$status,
$blogTags,
$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,
]);
}
}
\ No newline at end of file
<?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,
]);
}
}
\ No newline at end of file
<?php
namespace App\Http\Responses;
use Illuminate\Contracts\Support\Responsable;
class RedirectResponse implements Responsable
{
protected $route,
$message;
public function __construct($route, $message)
{
$this->route = $route;
$this->message = $message;
}
public function toResponse($request)
{
return redirect()
->route($this->route)
->with($this->message);
}
}
\ No newline at end of file
......@@ -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'),
],
......
......@@ -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');
}
......
......@@ -16,7 +16,6 @@ class ManageBlogTagsTest extends TestCase
->assertSee(trans('labels.backend.blogtags.management'))
->assertSee(trans('labels.backend.blogtags.table.title'))
->assertSee(trans('labels.backend.blogtags.table.status'))
->assertSee('Export')
->assertSee('Action');
}
......
......@@ -39,7 +39,6 @@ class ManageBlogsTest extends TestCase
->assertSee(trans('labels.backend.blogs.table.createdby'))
->assertSee(trans('labels.backend.blogs.table.createdat'))
->assertSee(trans('labels.backend.blogs.table.status'))
->assertSee('Export')
->assertSee('Action');
}
......
......@@ -17,7 +17,6 @@ class ManageFaqsTest extends TestCase
->assertSee(trans('labels.backend.faqs.table.question'))
->assertSee(trans('labels.backend.faqs.table.answer'))
->assertSee(trans('labels.backend.faqs.table.status'))
->assertSee('Export')
->assertSee('Action');
}
......
......@@ -18,7 +18,6 @@ class ManagePermissionsTest extends TestCase
->get(route('admin.access.permission.index'))
->assertViewIs('backend.access.permissions.index')
->assertSee(trans('labels.backend.access.permissions.management'))
->assertSee('Export')
->assertSee('Action');
}
......
......@@ -20,7 +20,6 @@ class ManageRolesTest extends TestCase
->get(route('admin.access.role.index'))
->assertViewIs('backend.access.roles.index')
->assertSee(trans('labels.backend.access.roles.management'))
->assertSee('Export')
->assertSee('Action');
}
......
......@@ -44,7 +44,6 @@ class ManageUsersTest extends TestCase
->assertViewIs('backend.access.users.index')
->assertSee(trans('labels.backend.access.users.management'))
->assertSee(trans('labels.backend.access.users.active'))
->assertSee('Export')
->assertSee('Action');
}
......@@ -56,7 +55,6 @@ class ManageUsersTest extends TestCase
->assertViewIs('backend.access.users.deactivated')
->assertSee(trans('labels.backend.access.users.management'))
->assertSee(trans('labels.backend.access.users.deactivated'))
->assertSee('Export')
->assertSee('Action');
}
......@@ -68,7 +66,6 @@ class ManageUsersTest extends TestCase
->assertViewIs('backend.access.users.deleted')
->assertSee(trans('labels.backend.access.users.management'))
->assertSee(trans('labels.backend.access.users.deleted'))
->assertSee('Export')
->assertSee('Action');
}
......
......@@ -24,12 +24,6 @@ class LoggedOutRouteTest extends BrowserKitTestCase
$this->visit('/')->assertResponseOk();
}
/** @test */
public function test_macroPage()
{
$this->visit('/macros')->see('Macro Examples');
}
/** @test */
public function testLoginPage()
{
......
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