54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Requests\ContactRequest;
|
|
use App\Http\Controllers\ShopController;
|
|
use App\Categorie;
|
|
use DB, Session;
|
|
use App\User;
|
|
use App\Message;
|
|
|
|
|
|
class PagesController extends MainController
|
|
{
|
|
public function home(){
|
|
self::$data['title'] .= 'Home Page';
|
|
self::$data['categories'] = Categorie::all()->toArray();
|
|
return view('content.home' , self::$data);
|
|
}
|
|
|
|
public function contact(){
|
|
if (Session::get('user_id') ) {
|
|
$user = User::getUserInfo();
|
|
self::$data['user'] = $user;
|
|
|
|
}
|
|
|
|
return view('content.contact' , self::$data);
|
|
}
|
|
public function postContact(ContactRequest $request){
|
|
Message::save_msg($request);
|
|
return redirect('contact');
|
|
}
|
|
//
|
|
// public function blog(){
|
|
// return view('content.blog' ,self::$data);
|
|
// }
|
|
public function content($url){
|
|
$contents = DB::table('contents')
|
|
->join('menus' , 'menus.id' , '=' , 'contents.menu_id')
|
|
->where('menus.url' , '=' , $url)
|
|
->get()
|
|
->toArray();
|
|
if (!$contents){
|
|
Abort(404);
|
|
} else{
|
|
self::$data['contents'] = $contents;
|
|
self::$data['title'] .= $contents[0]->mtitle;
|
|
return view('content.content',self::$data);
|
|
}
|
|
|
|
}
|
|
}
|