Commit ede46b19 authored by Vipul Basapati's avatar Vipul Basapati

Solves #144

parent 9f46d982
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
namespace App\Http\Controllers\Frontend; namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use App\Models\Settings\Setting; use App\Models\Settings\Setting;
use App\Repositories\Frontend\CMSPages\CMSPagesRepository; use App\Http\Controllers\Controller;
use App\Repositories\Frontend\Pages\PagesRepository;
/** /**
* Class FrontendController. * Class FrontendController.
...@@ -31,13 +31,13 @@ class FrontendController extends Controller ...@@ -31,13 +31,13 @@ class FrontendController extends Controller
} }
/** /**
* show cmspage by pageslug. * show page by $page_slug.
*/ */
public function showCMSPage($page_slug, CMSPagesRepository $RepositoryContract) public function showPage($slug, PagesRepository $pages)
{ {
$result = $RepositoryContract->findBySlug($page_slug); $result = $pages->findBySlug($slug);
return view('frontend.cmspages.index') return view('frontend.pages.index')
->withCmspages($result); ->withpage($result);
} }
} }
...@@ -14,10 +14,22 @@ trait PageAttribute ...@@ -14,10 +14,22 @@ trait PageAttribute
{ {
return '<div class="btn-group action-btn"> return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute('edit-page', 'admin.pages.edit').' '.$this->getEditButtonAttribute('edit-page', 'admin.pages.edit').'
'.$this->getViewButtonAttribute().'
'.$this->getDeleteButtonAttribute('delete-page', 'admin.pages.destroy').' '.$this->getDeleteButtonAttribute('delete-page', 'admin.pages.destroy').'
</div>'; </div>';
} }
/**
* @return string
*/
public function getViewButtonAttribute()
{
return '<a target="_blank" href="' . route('frontend.pages.show', $this->page_slug) . '" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="View Page" class="fa fa-eye"></i>
</a>';
}
/** /**
* @return string * @return string
*/ */
......
...@@ -29,6 +29,7 @@ class PagesRepository extends BaseRepository ...@@ -29,6 +29,7 @@ class PagesRepository extends BaseRepository
->select([ ->select([
config('module.pages.table').'.id', config('module.pages.table').'.id',
config('module.pages.table').'.title', config('module.pages.table').'.title',
config('module.pages.table') . '.page_slug',
config('module.pages.table').'.status', config('module.pages.table').'.status',
config('module.pages.table').'.created_at', config('module.pages.table').'.created_at',
config('module.pages.table').'.updated_at', config('module.pages.table').'.updated_at',
......
<?php <?php
namespace App\Repositories\Frontend\CMSPages; namespace App\Repositories\Frontend\Pages;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
use App\Models\CMSPages\CMSPage; use App\Models\Page\Page;
use App\Repositories\BaseRepository; use App\Repositories\BaseRepository;
/** /**
* Class CMSPagesRepository. * Class PagesRepository.
*/ */
class CMSPagesRepository extends BaseRepository class PagesRepository extends BaseRepository
{ {
/** /**
* Associated Repository Model. * Associated Repository Model.
*/ */
const MODEL = CMSPage::class; const MODEL = Page::class;
/* /*
* Find cmspage by pageslug * Find page by page_slug
*/ */
public function findBySlug($page_slug) public function findBySlug($page_slug)
{ {
...@@ -25,6 +25,6 @@ class CMSPagesRepository extends BaseRepository ...@@ -25,6 +25,6 @@ class CMSPagesRepository extends BaseRepository
return $this->query()->wherePage_slug($page_slug)->firstOrFail(); return $this->query()->wherePage_slug($page_slug)->firstOrFail();
} }
throw new GeneralException(trans('exceptions.backend.access.cmspages.not_found')); throw new GeneralException(trans('exceptions.backend.access.pages.not_found'));
} }
} }
@extends('frontend.layouts.app') @extends('frontend.layouts.app')
@section('content')
{!! $cmspages->description !!}
@section('content')
{!! $page->description !!}
@endsection @endsection
\ No newline at end of file
...@@ -38,6 +38,6 @@ Route::group(['middleware' => 'auth'], function () { ...@@ -38,6 +38,6 @@ Route::group(['middleware' => 'auth'], function () {
}); });
/* /*
* Show cmspages * Show pages
*/ */
Route::get('cmspage/{page_slug}', 'FrontendController@showCMSPage')->name('cmspages.show'); Route::get('pages/{slug}', 'FrontendController@showPage')->name('pages.show');
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