Exemple #1
0
    return "OK!";
});
Route::get('test_add_best', function () {
    BestSelling::increase(6);
});
//Untuk kepentingan debugging. bisa dihapus kemudian hari
Route::get('hapuscart', function () {
    Session::forget('shopping_cart');
    Session::forget('shopping_cart["item"]');
    Session::forget('shopping_cart["totalprice"]');
});
Route::get('test_locations', function () {
    $q = "vaio";
    $category = 6;
    $location = "Nangroe Aceh Darussalam";
    $products = Product::leftJoin('brands', function ($j) {
        $j->on('products.brand_id', '=', 'brands.id');
    })->leftJoin('users', function ($j) {
        $j->on('products.seller_id', '=', 'users.id');
    })->leftJoin('locations', function ($j) {
        $j->on('users.location_id', '=', 'locations.id');
    })->select('products.*')->where('products.name', 'like', '%' . $q . '%')->orWhere('brands.name', 'like', '%' . $q . '%');
    $products->where('category_id', '=', $category);
    $products->where('locations.province', '=', $location);
    foreach ($products->get() as $product) {
        echo $product->name . " " . $product->location;
    }
});
Route::get('courier_test', function () {
    return Courier::all()->first()->company_name;
});