edit static pages in backend
This commit is contained in:
parent
e771c4921f
commit
783ac823ba
59 changed files with 1644 additions and 761 deletions
104
app/Http/Controllers/Frontend/HomeController.php
Normal file
104
app/Http/Controllers/Frontend/HomeController.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
use App\Exceptions\GeneralException;
|
||||
use App\Models\Page;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
// $tglSekarang = time();
|
||||
|
||||
// $students = Student::get();
|
||||
|
||||
// foreach ($students as $student) {
|
||||
|
||||
// $dateDiff = $tglSekarang - $student['registered_at'];
|
||||
// $durasi = floor($dateDiff/(60 * 60 * 24));
|
||||
// $periode = Periode::first();
|
||||
// if($durasi > $periode['days']){
|
||||
// $student->update(['status' => 0]);
|
||||
// }
|
||||
// else{
|
||||
// $student->update(['status' => 1]);
|
||||
// }
|
||||
|
||||
// }
|
||||
return view('frontend.home.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function contact(): View
|
||||
{
|
||||
return view('frontend.home.contact');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function imprint(): View
|
||||
{
|
||||
return view('frontend.home.imprint');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function about(): View
|
||||
{
|
||||
return view('frontend.home.about');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function news(): View
|
||||
{
|
||||
return view('frontend.home.news');
|
||||
}
|
||||
|
||||
/**
|
||||
* show page by $page_slug.
|
||||
*/
|
||||
public function showPage($slug)
|
||||
{
|
||||
// $result = $pages->findBySlug($slug);
|
||||
if (!is_null(Page::query()->wherePage_slug($slug)->firstOrFail())) {
|
||||
$result = Page::query()->wherePage_slug($slug)->firstOrFail();
|
||||
return view('frontend.pages.index')
|
||||
->withpage($result);
|
||||
} else {
|
||||
throw new GeneralException(trans('exceptions.backend.access.pages.not_found'));
|
||||
}
|
||||
}
|
||||
}
|
37
app/Http/Controllers/Frontend/PagesController.php
Normal file
37
app/Http/Controllers/Frontend/PagesController.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Dataset;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class PagesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
public function datasets() : View
|
||||
{
|
||||
// $books = Book::with('category', 'shelf')->orderByTitle()->get();
|
||||
$documents = Dataset::orderByType()->get();
|
||||
return view('frontend.dataset.dataset', compact('documents'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id): View
|
||||
{
|
||||
$document = Dataset::findOrFail($id);
|
||||
$document->load('titles');
|
||||
$document->load('abstracts');
|
||||
return view('frontend.dataset.show', compact('document'));
|
||||
}
|
||||
}
|
60
app/Http/Controllers/Frontend/SitelinkController.php
Normal file
60
app/Http/Controllers/Frontend/SitelinkController.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Dataset;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SitelinkController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
//get server state published
|
||||
$serverState = 'published';
|
||||
$select = DB::table('documents')
|
||||
->where('server_state', 'LIKE', "%" . $serverState . "%");
|
||||
|
||||
$select
|
||||
->select(DB::raw('YEAR(published_date) as published_date'))
|
||||
->distinct(true);
|
||||
|
||||
$this->years = $select->pluck('published_date');
|
||||
$this->ids = array();
|
||||
return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
|
||||
}
|
||||
|
||||
public function list($year)
|
||||
{
|
||||
$this->index();
|
||||
if (preg_match('/^\d{4}$/', $year) > 0) {
|
||||
$serverState = 'published';
|
||||
//$select = DB::table('documents')
|
||||
//->where('server_state','LIKE', "%".$serverState."%");
|
||||
$select = Dataset::with('titles', 'authors')
|
||||
->where('server_state', 'LIKE', "%" . $serverState . "%");
|
||||
|
||||
$from = (int)$year;
|
||||
$until = $year + 1;
|
||||
$select
|
||||
->whereYear('server_date_published', '>=', $from)
|
||||
->whereYear('server_date_published', '<', $until);
|
||||
|
||||
$documents = $select
|
||||
->get();
|
||||
|
||||
//$this->years = Dataset::select(DB::raw('YEAR(server_date_modified) as server_date_modified'))
|
||||
//->distinct(true)
|
||||
//->pluck('server_date_modified');
|
||||
//->filter(function ($item) use ($year){
|
||||
// return $item->year !== $year;
|
||||
//});
|
||||
|
||||
//$select->select('id');
|
||||
//$this->ids = $select->pluck('id');
|
||||
//return view('rdr.sitelink.index')->with(['years'=> $this->years,'ids'=> $this->ids]);
|
||||
return view('frontend.sitelink.index')
|
||||
->with(['years' => $this->years, 'documents' => $documents]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue