2017-08-27 04:44:53 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Ejaculation;
|
2017-11-03 20:38:09 +09:00
|
|
|
use App\Information;
|
2017-08-27 04:44:53 +09:00
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the application dashboard.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
if (Auth::check()) {
|
2017-11-03 20:38:09 +09:00
|
|
|
$informations = Information::query()
|
|
|
|
->select('id', 'category', 'pinned', 'title', 'created_at')
|
2017-11-07 00:57:33 +09:00
|
|
|
->orderByDesc('pinned')
|
2017-11-03 20:38:09 +09:00
|
|
|
->orderByDesc('created_at')
|
|
|
|
->paginate(3);
|
|
|
|
$categories = Information::CATEGORIES;
|
|
|
|
|
2017-11-05 01:26:52 +09:00
|
|
|
return view('home')->with(compact('informations', 'categories'));
|
2017-08-27 04:44:53 +09:00
|
|
|
} else {
|
|
|
|
return view('guest');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|