tethys/app/Http/Controllers/Frontend/HomeController.php

130 lines
2.8 KiB
PHP
Raw Normal View History

2018-08-06 12:30:51 +00:00
<?php
2018-09-06 15:58:54 +00:00
namespace App\Http\Controllers\Frontend;
2018-08-06 12:30:51 +00:00
2018-09-06 15:58:54 +00:00
use App\Exceptions\GeneralException;
2018-09-07 13:31:05 +00:00
use App\Http\Controllers\Controller;
2018-09-06 15:58:54 +00:00
use App\Models\Page;
2018-09-07 13:31:05 +00:00
use Illuminate\View\View;
2018-09-06 15:58:54 +00:00
2018-08-06 12:30:51 +00:00
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware('auth');
}
2018-09-10 13:09:10 +00:00
public function test(): View
{
return view('welcome');
}
2018-08-06 12:30:51 +00:00
/**
* 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]);
// }
// }
2018-09-06 15:58:54 +00:00
return view('frontend.home.index');
2018-08-06 12:30:51 +00:00
}
2018-09-07 13:31:05 +00:00
/**
2018-08-06 12:30:51 +00:00
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function contact(): View
{
2018-09-06 15:58:54 +00:00
return view('frontend.home.contact');
2018-08-06 12:30:51 +00:00
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function imprint(): View
{
2018-09-06 15:58:54 +00:00
return view('frontend.home.imprint');
2018-08-06 12:30:51 +00:00
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function intro(): View
2018-08-06 12:30:51 +00:00
{
return view('frontend.home.intro');
2018-08-06 12:30:51 +00:00
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function news(): View
{
2018-09-06 15:58:54 +00:00
return view('frontend.home.news');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function services(): View
{
return view('frontend.home.services');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function help(): View
{
return view('frontend.home.help');
}
2018-09-06 15:58:54 +00:00
/**
* show page by $page_slug.
*/
2018-10-04 14:41:29 +00:00
public function showPage($slug): View
2018-09-06 15:58:54 +00:00
{
// $result = $pages->findBySlug($slug);
2018-10-04 14:41:29 +00:00
if (!is_null(Page::query()->where('page_slug', $slug)->firstOrFail())) {
$result = Page::query()->where('page_slug', $slug)->firstOrFail();
return view('frontend.pages.index')->withpage($result);
2018-09-06 15:58:54 +00:00
} else {
throw new GeneralException(trans('exceptions.backend.access.pages.not_found'));
}
2018-08-06 12:30:51 +00:00
}
public function php_info()
{
dd(phpinfo());
}
2018-08-06 12:30:51 +00:00
}