| 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/primehomes.vn/app/Http/Controllers/ |
Upload File : |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Session;
use App\Models\CatePost;
use App\Models\CatePost2;
use App\Models\Slider;
use App\Models\Contact;
use App\Models\Category;
use App\Models\Post;
use App\Models\Product;
use App\Models\Attr;
use App\Models\Icons;
use App\Http\Requests;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Http\Controllers\Controller;
session_start();
use Auth;
use Illuminate\Session\Middleware\StartSession;
class ContactController extends Controller
{
public function add_doitac(Request $request){
$data = $request->all();
$icons = new Icons();
$name = $data['name'];
$link = $data['link'];
$get_image = $request->file('file');
$path = 'public/uploads/icons/';
//them hinh anh
if($get_image){
$get_name_image = $get_image->getClientOriginalName();
$name_image = current(explode('.',$get_name_image));
$new_image = $name_image.rand(0,99).'.'.$get_image->getClientOriginalExtension();
$get_image->move($path,$new_image);
$icons->image = $new_image;
}
$icons->name = $name;
$icons->link = $link;
$icons->category = 'doitac';
$icons->save();
}
public function add_nut(Request $request){
$data = $request->all();
$icons = new Icons();
$name = $data['name'];
$link = $data['link'];
$get_image = $request->file('file');
$path = 'public/uploads/icons/';
//them hinh anh
if($get_image){
$get_name_image = $get_image->getClientOriginalName();
$name_image = current(explode('.',$get_name_image));
$new_image = $name_image.rand(0,99).'.'.$get_image->getClientOriginalExtension();
$get_image->move($path,$new_image);
$icons->image = $new_image;
}
$icons->name = $name;
$icons->link = $link;
$icons->category = 'icons';
$icons->save();
}
public function delete_icons(){
$id = $_GET['id'];
$icons = Icons::find($id);
$icons->delete();
}
public function list_doitac(){
$icons = Icons::where('category','doitac')->orderBy('id_icons','DESC')->get();
// dd($icons);
$output = '';
$output .= '<table class="table table-hover">
<thead>
<tr>
<th>Tên đối tác</th>
<th>Hình ảnh đối tác</th>
<th>Link đối tác</th>
<th>Quản lý</th>
</tr>
</tr>
</thead>
<tbody>';
foreach($icons as $ico){
$output .= ' <tr>
<td>'.$ico->name.'</td>
<td><img height="80px" width="150px" src="'.url('/public/uploads/icons/'.$ico->image).'"></td>
<td>'.$ico->link.'</td>
<td><button id="'.$ico->id_icons.'" class="btn btn-warning" onclick="delete_icons(this.id)">Xóa đối tác</button></td>
</tr>';
}
$output .= '</tbody>
</table>';
echo $output;
}
public function list_nut(){
$icons = Icons::where('category','icons')->orderBy('id_icons','DESC')->get();
// dd($icons);
$output = '';
$output .= '<table class="table table-hover">
<thead>
<tr>
<th>Tên nút</th>
<th>Hình ảnh</th>
<th>Link</th>
<th>Quản lý</th>
</tr>
</tr>
</thead>
<tbody>';
foreach($icons as $ico){
$output .= ' <tr>
<td>'.$ico->name.'</td>
<td><img height="32px" width="32px" src="'.url('/public/uploads/icons/'.$ico->image).'"></td>
<td>'.$ico->link.'</td>
<td><button id="'.$ico->id_icons.'" class="btn btn-danger" onclick="delete_icons(this.id)">Xóa</button></td>
</tr>';
}
$output .= '</tbody>
</table>';
echo $output;
}
public function lien_he(Request $request){
//category post
$categorypost = CatePost2::orderBy('categorypost_id','DESC')->get();
$all_post=Post::orderby('post_id','desc')->get();
//
$category_post = CatePost::orderBy('cate_post_id','DESC')->get();
$cate_product=Category::where('category_status','1')->orderby('category_id','desc')->with('cate')->get();
$all_attr=Attr::orderby('attr_id','desc')->with('product')->take(24)->get();
$all_product=Product::where('product_status','1')->orderby('product_id','desc')->get();
//slide
$slide = Slider::orderBy('slider_id','DESC')->where('slider_status','1')->take(4)->get();
//seo
$meta_desc = "Liên hệ";
$meta_keywords = "Liên hệ";
$meta_title = "Liên hệ chúng tôi";
$url_canonical = $request->url();
//--seo
$cate_product = DB::table('tbl_category_product')->where('category_status','0')->orderby('category_id','desc')->get();
$brand_product = DB::table('tbl_brand')->where('brand_status','0')->orderby('brand_id','desc')->get();
$contact = Contact::where('info_id',1)->get();
return view('pages.lienhe.contact')->with('category',$cate_product)->with('brand',$brand_product)->with('meta_desc',$meta_desc)->with('meta_keywords',$meta_keywords)->with('meta_title',$meta_title)->with('url_canonical',$url_canonical)->with('slide',$slide)->with('category_post',$category_post)->with('contact',$contact)->with('cate_product',$cate_product)->with('all_attr',$all_attr)->with('all_product',$all_product)->with('categorypost',$categorypost)->with('all_post',$all_post);
}
public function information(){
$contact = Contact::where('info_id',1)->get();
return view('admin.information.add_information')->with(compact('contact'));
}
public function update_info(Request $request,$info_id){
$data = $request->all();
$contact = Contact::find($info_id);
$contact->info_contact = $data['info_contact'];
$contact->slogan_logo = $data['slogan_logo'];
$contact->info_map = $data['info_map'];
$contact->adress = $data['adress'];
$contact->mobile = $data['mobile'];
$contact->email = $data['email'];
$contact->taxnumber = $data['taxnumber'];
$contact->info_fanpage = $data['info_fanpage'];
$get_image = $request->file('info_image');
$path = 'public/uploads/contact/';
if($get_image){
unlink($path.$contact->info_logo);
$get_name_image = $get_image->getClientOriginalName();
$name_image = current(explode('.',$get_name_image));
$new_image = $name_image.rand(0,99).'.'.$get_image->getClientOriginalExtension();
$get_image->move($path,$new_image);
$contact->info_logo = $new_image;
}
$contact->save();
return redirect()->back()->with('message','Cập nhật thông tin website thành công');
}
public function save_info(Request $request){
$data = $request->all();
$contact = new Contact();
$contact->info_contact = $data['info_contact'];
$contact->info_map = $data['info_map'];
$contact->info_fanpage = $data['info_fanpage'];
$get_image = $request->file('info_image');
$path = 'public/uploads/contact/';
if($get_image){
$get_name_image = $get_image->getClientOriginalName();
$name_image = current(explode('.',$get_name_image));
$new_image = $name_image.rand(0,99).'.'.$get_image->getClientOriginalExtension();
$get_image->move($path,$new_image);
$contact->info_logo = $new_image;
}
$contact->save();
return redirect()->back()->with('message','Cập nhật thông tin website thành công');
}
}