403Webshell
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/huyhoangvn.com/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/huyhoangvn.com/app/Http/Controllers//CountryProduct.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use App\Models\Brand;
use App\Models\Country;
use App\Http\Requests;
use Session;
use Illuminate\Support\Facades\Redirect; 
use App\Http\Controllers\Controller;
session_start();


class CountryProduct extends Controller
{     
     public function AuthLogin() {
        $admin_id=session::get('admin_id');
        if($admin_id){
            return Redirect::to('dashboard');
        }
        else{
        return Redirect::to('admin')->send();
        }
    }

    public function add_Country_product(){
    $this->AuthLogin();
        return view('admin.country.add_country_product');
    }
        

        public function all_country_product(){

        $all_country_product=Country::orderby('country_id','DESC')->get(); //thông qua model   
        //$all_brand_product=Brand::orderby('brand_id','DESC')->paginate(3); phân trang 
        //$all_brand_product=Brand::orderby('brand_id','DESC')->take(3)->get(); // take (3) lấy 3 
        // $all_brand_product= DB::table('tbl_brand')->get();// trực tiếp trên cotroller
       // $manager_brand_product = view('admin.all_brand_product')->with('all_brand_product',$all_brand_product);

        return view('admin.country.all_country_product')->with(compact('all_country_product'));


    }
        public function save_country_product(Request $Request){
        $this->AuthLogin();
        $data=$Request->all();
        $country=new Country();
        $country->country_name=$data['country_product_name']; 
        $country->slug_country_product=$data['slug_country_product'];
        $country->country_desc=$data['country_product_desc'];
        $country->country_status=$data['country_product_status'];
        $country->meta_keywords=$data['country_product_keywords'];
        $country->save();
        // $data=array();
        // $data['brand_name']=$Request->brand_product_name;
        // $data['slug_brand_product']=$Request->slug_brand_product;
        // $data['meta_keywords']=$Request->brand_product_keywords;
        // $data['brand_desc']=$Request->brand_product_desc;
        // $data['brand_status']=$Request->brand_product_status;
        //DB::table('tbl_brand')->insert($data);
        Session::put('message', 'Thêm danh mục sản phẩm thành công');
        return Redirect::to('/all-country-product');
    }
        public function unactive_country_product($country_product_id){
        $this->AuthLogin();
DB::table('tbl_country')->where('country_id',$country_product_id)->update(['country_status'=>1]);
Session::put('message', 'Không kích hoạt thành công trạng thái');
        return Redirect::to('/all-country-product');
    }
        public function active_country_product($country_product_id){
        $this->AuthLogin();    

    DB::table('tbl_country')->where('country_id',$country_product_id)->update(['country_status'=>0]);
Session::put('message', 'Không kích hoạt thành công trạng thái');
        return Redirect::to('/all-country-product');
    }

      public function edit_country_product($country_product_id){
      $this->AuthLogin();
     //$edit_brand_product= DB::table('tbl_brand')->where('brand_id',$brand_product_id)->get();
     $edit_country_product=Country::find($country_product_id);
     $manager_country_product = view('admin.country.edit_country_product')->with('edit_country_product',$edit_country_product);
    return view('admin_layout')->with('admin.country.edit_country_product', $manager_country_product);
    } 
    public function update_country_product(Request $Request, $country_product_id){
    $this->AuthLogin();

        $data=$Request->all();
        $country=Country::find($country_product_id);
        $country->country_name=$data['country_product_name']; 
        $country->slug_country_product=$data['slug_country_product'];
        $country->country_desc=$data['country_product_desc'];
        $country_product_id->meta_keywords=$data['country_product_keywords'];
        $country->save();
        // $data=array();
        // $data['brand_name']=$Request->brand_product_name;
        // $data['brand_desc']=$Request->brand_product_desc;
        // $data['slug_brand_product']=$Request->slug_brand_product;
        // $data['meta_keywords']=$Request->brand_product_keywords;  
        // DB::table('tbl_brand')->where('brand_id',$brand_product_id)->update($data);
        Session::put('message', 'cập nhật thành công');
        return Redirect::to('/all-country-product');
    }   
     public function delete_country_product($country_product_id) {
    $this->AuthLogin();
    DB::table('tbl_country')->where('country_id',$country_product_id)->delete();
        Session::put('message', 'xóa thành thành công');
        return Redirect::to('/all-country-product');
     }    
     //and admin function 
     //(lấy dữ liệu cho trang hiễn thị sản phẩm theo thương hiệu)
      public function show_country_home(Request $request, $slug_country_product) {
    $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();
    $country_product=DB::table('tbl_country')->where('country_status','1')->orderby('country_id','desc')->get();
    $country_by_id=DB::table('tbl_country')->where('country_status','1')->join('tbl_country','tbl_product.country_id','=','tbl_country.country_id')->where('tbl_country.slug_country_product',$slug_country_product)->get();

    $meta_desc=collect();
    $meta_keywords=collect();
    $meta_title=collect();
    $url_canonical=collect();  
    foreach ($brand_by_id as $key => $val) {
        $meta_desc=$val->country_desc;
        $meta_keywords=$val->meta_keywords;
        $meta_title=$val->country_name;
        $url_canonical= $request->url();
    }
    

    $country_name= DB::table('tbl_country')->where('tbl_country.slug_country_product',$slug_country_product)->limit(1)->get();
        // return view('pages.brand.show_brand')->with('category',$cate_product)->with('brand',$brand_product)->with('brand_by_id',$brand_by_id)->with('brand_name',$brand_name);
        return view('pages.country.show_country')->with(compact('cate_product','brand_product','country_product','country_by_id','country_name','meta_keywords','meta_desc','meta_title','url_canonical')); 

    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit