| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/tipsysaigon.vn/app/Http/Controllers/ |
Upload File : |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Mail;
use File;
use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Http\Requests;
use Session;
use App\Models\Product;
use App\Models\Category;
use App\Models\Cate;
use App\Models\Post;
use App\Models\Attr;
use Illuminate\Support\Facades\Redirect;
use App\Http\Controllers\Controller;
session_start();
use App\Models\Slider;
class HomeController extends Controller
{
//--send mail
public function send_mail(){
$to_name = "Cầm Nguyễn";
$to_email = "nguyendinhhoaicam@gmail.com";//send to this email
$data = array("name"=>"gởi từ website shopbanhang.com","body"=>"bán sản phẩm"); //body of mail.blade.php
Mail::send('pages.send_mail',$data,function($message) use ($to_name,$to_email){
$message->to($to_email)->subject('test mail nhé');//send this mail with subject
$message->from($to_email,$to_name);//send from this mail
});
return redirect('/')->with('message','');
}
public function index(request $request){
$slide =Slider::orderby('slider_id','desc')->get();
// SEO
$meta_desc="mo ta san pham";
$meta_keywords="san pham quan ao";
$meta_title="quan ao thoi trang ";
$url_canonical= $request->url();
// END SEO
$cate_product=Category::where('category_status','1')->orderby('category_id','desc')->with('cate')->get();
$brand_product=DB::table('tbl_brand')->where('brand_status','1')->orderby('brand_id','desc')->get();
$all_product=DB::table('tbl_product')->where('product_status','1')->orderby('product_id','desc')->get();
foreach($all_product as $key => $pro){
$product_id= $pro->product_id;
}
$all_attr =Attr::orderby('attr_id','desc')->with('product')->take(8)->get();
$all_post=Post::orderby('post_id','ASC')->get();
return view('pages.home')->with(compact('cate_product','brand_product','all_product','meta_keywords','meta_desc','meta_title','url_canonical','slide','all_attr','all_post'));
}
public function search(Request $Request){
//Seo
$meta_desc="Tìm kiếm sản phẩm ";
$meta_keywords="Tìm kiếm sản phẩm";
$meta_title="Tìm kiếm sản phẩm ";
$url_canonical= $Request->url();
//endseo
$keywords = $Request->keywords_submit;
$cate_product=DB::table('tbl_category_product')->where('category_status','1')->orderby('category_id','desc')->get();
$brand_product=DB::table('tbl_brand')->where('brand_status','1')->orderby('brand_id','desc')->get();
$search_product =DB::table('tbl_product')->where('product_name','Like','%'.$keywords.'%')->where('product_status','1')->get();
// return view('pages.sanpham.search')->with('category',$cate_product)->with('brand',$brand_product)->with('search_product',$search_product);
return view('pages.sanpham.search')->with(compact('cate_product','brand_product','search_product','meta_keywords','meta_desc','meta_title','url_canonical'));
}
}