Stank0V01

IplexMC at IplexMC

Experience

1,730

0 Best Reply Awards

  • Member Since 1 Month Ago
  • 3 Lessons Completed
  • 0 Favorites

18th August, 2018

Stank0V01 left a reply on Getting Monthly Price Sum From Specific Year • 2 days ago

@Abi @Cronix And the price is depend on product price

Orders table:

product_id
user_id

Product table:

id
name
*price

Stank0V01 left a reply on Getting Monthly Price Sum From Specific Year • 2 days ago

@Abi I want when mounth is 0 to give 0 price i mean return to be

[
"01" => "10",
"02"=> "0",
"03" => "0",
etc
etc.
etc.



]

Stank0V01 left a reply on Getting Monthly Price Sum From Specific Year • 2 days ago

bump

Stank0V01 started a new conversation Get All Mounths Revenue! • 2 days ago

Hello guys.. I use that for my chart https://github.com/fxcosta/laravel-chartjs..

I have orders table with that columns

/product_id
/user_id

I have hasMany relationship between Order and Product models

My Order mode:

<?php

namespace App;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    protected $fillable = ['product_id', 'm_c_user_id', 'site_id'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo(MCUser::class, 'm_c_user_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function product()
    {
        return $this->belongsTo(Product::class);
    }

    /**
     * @return int
     */
    public function getTotalPrice($siteID)
    {

        $orders = self::with('product')->where('site_id', $siteID)->get();
        $total = $orders->sum('product.price');
        return $total;
    }

    /**
     * @return mixed
     */
    public function getTodayTurnover($siteID)
    {
        $orders = self::with('product')->where('site_id', $siteID)->get();
        $total = $orders->where('created_at', '>=', Carbon::today())->sum('product.price');

        return $total;
    }

}

I want to make something like that http://prntscr.com/kk3ude

To get for each mounth total revenue! Please help!

11th August, 2018

Stank0V01 left a reply on Multi Domain Auth Problem! • 1 week ago

smo ;(

Stank0V01 started a new conversation Multi Domain Auth Problem! • 1 week ago

So hello guys.. I have problem with auth.. So lets explain more details!

I have main page mydomain.com and it use default laravel auth.. I have shop page {slug_of_shop}.mydomain.com and auth is only with username.. i have another table for user that not have password column and other things.

So i want to login user on subdomain with only username.. How it will be done that?

My Routes:

<?php

$mainRouter = function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');
    Auth::routes();

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');
    });

};
Route::group(['domain' => env('PLAIN_URL')], $mainRouter);
Route::group(['domain' => 'www.'.env('PLAIN_URL')], $mainRouter);

// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware' => 'ShopExist'], function () {
    Route::get('/', 'Shop\[email protected]');
    Route::get('/language/{lang}', 'Shop\[email protected]');
    Route::get('/currency/{currency}', 'Shop\[email protected]');
    Route::get('/category/{category}', 'Shop\[email protected]');

    Route::group(['prefix' => 'auth'], function () {
        Route::get('/login','Shop\[email protected]')->middleware('guest');
        Route::get('/logout','Shop\[email protected]')->middleware('auth');
        Route::post('/login','Shop\[email protected]')->middleware('guest');
    });

});

My Shop\AuthController.php

<?php

namespace App\Http\Controllers\Shop;

use App\Http\Controllers\Controller;
use App\Http\Requests\UserCreate;
use App\MCUser;
use App\Setting;
use App\Site;
use Auth;
use Illuminate\Http\Request;

class AuthController extends Controller
{

    public $theme;
    public $site_id;

    /**
     * CategoryController constructor.
     */
    public function __construct(Request $request)
    {
        $site_id = Site::where('slug', $request->route()->parameter('slug'))->first()->id;

        $theme = Setting::where('key', 'theme')->where('site_id', $site_id)->first()->value;

        $this->theme = $theme;
        $this->site_id = $site_id;
    }

    /**
     * @param $user
     */
    private function login($user)
    {
        Auth::login($user);
    }

    /**
     * @param $slug
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function page($slug = null)
    {
        return view('shop.themes.' . $this->theme . '.pages.login');
    }

    /**
     * @param UserCreate $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function create($slug = null, UserCreate $request)
    {

        $createUser = MCUser::firstOrCreate(
            ['username' => $request->input('username'), 'site_id' => $this->site_id]
        );

        $this->login($createUser);

        return redirect()->to('/');

    }

    /**
     * @return \Illuminate\Http\RedirectResponse
     */
    public function logout()
    {
        Auth::logout();
        return redirect('/');
    }
}

Stank0V01 left a reply on Dynamic SubDomain Issue. • 1 week ago

<?php

$mainRouter = function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');
    Auth::routes();

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');
    });

};
Route::group(['domain' => env('PLAIN_URL')], $mainRouter);
Route::group(['domain' => 'www.'.env('PLAIN_URL')], $mainRouter);

// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware' => 'ShopExist'], function () {
    Route::get('/', 'Shop\[email protected]');
    Route::get('/language/{lang}', 'Shop\[email protected]');
    Route::get('/currency/{currency}', 'Shop\[email protected]');
    Route::get('/category/{category}', 'Shop\[email protected]');

    Route::group(['prefix' => 'auth'], function () {
        Route::get('/login','Shop\[email protected]')->middleware('guest');
        Route::get('/logout','Shop\[email protected]')->middleware('auth');
        Route::post('/login','Shop\[email protected]')->middleware('guest');
    });

});

Fixed it with that .

https://stackoverflow.com/questions/34608227/how-to-exclude-www-from-dynamically-created-subdomain

Stank0V01 started a new conversation Dynamic SubDomain Issue. • 1 week ago

Hello, guys.. so i have problem with dynamic subdomain routing! So here is my web.php

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['domain' => env('PLAIN_URL')], function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');
    Auth::routes();

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');
    });

});

// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware' => 'ShopExist'], function () {
    Route::get('/', 'Shop\[email protected]');
    Route::get('/language/{lang}', 'Shop\[email protected]');
    Route::get('/currency/{currency}', 'Shop\[email protected]');
    Route::get('/category/{category}', 'Shop\[email protected]');

    Route::group(['prefix' => 'auth'], function () {
        Route::get('/login','Shop\[email protected]')->middleware('guest');
        Route::get('/logout','Shop\[email protected]')->middleware('auth');
        Route::post('/login','Shop\[email protected]')->middleware('guest');
    });

});


So when i try www.mydomain.com it not work work only with my main domain mydomain.com But when i add www to first route group it again not work :/

10th August, 2018

Stank0V01 started a new conversation New Session Per Subdomain! • 1 week ago

Hello im tryna make one auth session per domain! So here is more details.

I want to make something like that:

https://ultranetwork.buycraft.net http://ownagepe.buycraft.net/

All of that sites have own session and when loggin in in one of it in another site you must loggin in again. So here is my routes

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['domain' => env('PLAIN_URL')], function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');
    Auth::routes();

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');
    });

});

// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware' => 'ShopExist'], function () {
    Route::get('/', 'Shop\[email protected]');
    Route::get('/language/{lang}', 'Shop\[email protected]');
    Route::get('/currency/{currency}', 'Shop\[email protected]');
    Route::get('/category/{category}', 'Shop\[email protected]');

    Route::group(['prefix' => 'auth'], function () {
        Route::get('/login','Shop\[email protected]')->middleware('guest');
        Route::get('/logout','Shop\[email protected]')->middleware('auth');
        Route::post('/login','Shop\[email protected]')->middleware('guest');
    });

});


My Session.php config

<?php

return [


    'driver' => env('SESSION_DRIVER', 'database'),


    'lifetime' => env('SESSION_LIFETIME', 120),

    'expire_on_close' => true,


    'encrypt' => true,


    'files' => storage_path('framework/sessions'),


    'connection' => null,


    'table' => 'sessions',


    'store' => null,


    'lottery' => [2, 100],


    'cookie' => 'myshopmcsession',


    'path' => '/',


    'domain' => env('PLAIN_URL'),


    'secure' => env('SESSION_SECURE_COOKIE', false),


    'http_only' => true,


    'same_site' => null,

];

So when you loggin in in one site to not log you in another!

Stank0V01 left a reply on Pass Variable To AppServiceProvider • 1 week ago

I fixed it with called Route facade !

Code:

$site_slug = Route::current()->parameter('slug');

P.S

Don't forget to add "use" use Illuminate\Support\Facades\Route;

Stank0V01 started a new conversation Pass Variable To AppServiceProvider • 1 week ago

Hello, i have problem with passing variable to AppServiceProvider.

So here is what i want:

First my routes:

<?php

Route::group(['domain' => env('PLAIN_URL')], function () {
    Route::get('/', '[email protected]')->name('home');
    Route::post('/gdpr', '[email protected]');

// Main site cart
    Route::group(['prefix' => 'cart'], function () {
        Route::post('/checkout', '[email protected]')->name('checkout');
        Route::get('/success', '[email protected]')->name('purchaseSuccess');
        Route::get('/failed', '[email protected]')->name('purchaseFailed');
        Route::put('/proccess', '[email protected]')->name('purchase');
        Route::get('/check', '[email protected]')->name('check');
    });

});

// Shop things content
Route::group(['domain' => '{slug}.' . env('PLAIN_URL'), 'middleware'=>'ShopExist'], function () {
    Route::get('/','Shop\[email protected]');
});

Auth::routes();

So when someone call {slug}.mydomain.com i want slug to my service provider. Please help! Thanks..

P.S

I try with request()->get() and many other ways.. But service provider is loaded before request procceed

Stank0V01 started a new conversation Provide Custom Variable To Main DatabaseSeeder And Give It To My Seeders • 1 week ago

Hello, someone can give me some example how to provide custom variable to my database seeder and then to give it on my custom seeder!

I want smth like this:

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run($my_custom_variable_from_model_for_example)
    {
        $this->call(SettingsTableSeeder::class, $my_custom_variable_from_model_for_example);
    }
}

Help.. Thanks!

26th July, 2018

Stank0V01 left a reply on HasMany Relation Ship, To Get Data From One To One Relation Model • 3 weeks ago

I fixed it with that https://laravel.com/docs/5.5/eloquent-relationships#eager-loading,

here what i make:

Order.php
    public function getTotalPrice() {

        $orders = self::with('product.sms')->get();
        $total = $orders->pluck('product.sms')->sum('price');
        return $total;
    }

Stank0V01 started a new conversation HasMany Relation Ship, To Get Data From One To One Relation Model • 3 weeks ago

Hello i have 3 tables, so here it

sms\
:id
:price
:servID

Product\
:id
:name
:sms_id
:description

Orders\
:id
:product_id
:user_id

What i want i want to get all products from orders and sum price of product (it depend ot sms price so i use sms_id in product, i call it like this $product->sms->price)

How this will be done?

Here is my models:

class Product extends Model
{
    protected $fillable = [];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function orders(){
        return $this->hasMany(Order::class);
    }
    public function sms() {
        return $this->hasOne(Sms::class,'id','sms_id');
    }

}

class Orders extends Model 
{
    public function product() {
        return $this->belongsTo(Product::class);
    }
}

class Sms extends Model
{
    public function product() {
        return $this->belongsTo(Product::class);
    }
}


23rd July, 2018

Stank0V01 started a new conversation Get Name From Second Table (belongsTo RelationShip) • 4 weeks ago

Hello guys, i have problem with displaying data from second table! So here is my db structure first:

category:
\id
\name
\parent_id
\vissible

notifications:
\id
\title
\content

category_notification:
\category_id
\notification_id

Model examples

Notification model:

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function categories() {
        return $this->belongsToMany(Category::class,'category_notification');
    }


Category model:

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function notifications() {
        return $this->belongsToMany(Notification::class);
    }

My code:

$notifications = Notification::with('categories')->get();

foreach($notifications as $nft) {

 echo $nft->name.'<br>'.$nft->categories-title

}

What im doing wrong?

19th July, 2018

Stank0V01 left a reply on Array To String Conversion On One To One Relation Ship ERROR! • 1 month ago

Oh, boys. It was from protected $table = ['sms'] I make it to protected $table = 'sms' and all works fine! :)

Stank0V01 left a reply on Array To String Conversion On One To One Relation Ship ERROR! • 1 month ago

I call it like this $var = Product::find(1); $var->sms

Stank0V01 left a reply on Array To String Conversion On One To One Relation Ship ERROR! • 1 month ago

My tables:

products: \id \name \desc \sms_id

sms: \id \text \number \servID

18th July, 2018

Stank0V01 started a new conversation Array To String Conversation On One To One Relation Ship! • 1 month ago

Hello guys, i have a problem with one to one relationship! When i make it it give that error

 Array to string conversion in D:/laragon/www/ishop-bg/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php on line 63

Here is my model

Product.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $fillable = [];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function sms() {
        return $this->hasOne(Sms::class,'sms_id');
    }
}
Sms.php

17th July, 2018

Stank0V01 started a new conversation How To Make Active Class When It Have Sub Category? • 1 month ago

Hello guys im tryna to make active class when is clicked on subcategory

            <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="{{ isActive('/') }}"><a href="{{ url('/') }}"><b class="fa fa-home"></b> @lang('messages.home')</a></li>
                    @foreach ($categories as $cat)
                        <li class="{{ $cat->children->count() > 0 ? 'dropdown' : ''}} {{ isActive('/category/'.$cat->slug) }}">
                            <a href="{{ url('/category/'.$cat->slug) }}" class="{{ $cat->children->count() > 0 ? 'dropdown-toggle' : ''  }}"
                               data-toggle="{{ $cat->children->count() > 0 ? 'dropdown' : ''  }}">
                                {{$cat->name}} {!! $cat->children->count() > 0 ? '<b class="fa fa-caret-down"></b>' : '' !!}
                            </a>
                            <ul class="dropdown-menu">
                            @foreach($subcategories as $sub)
                                @if($sub->parent_id == $cat->id)
                                        <li><a href="{{ url('category/'.$sub->slug) }}">{{ $sub->name }}</a></li>
                                @endif
                            @endforeach
                            </ul>
                         </li>
                    @endforeach
                </ul>
            </div>

How it will be done (isActive function is my custom helper that i make here it is)

<?php
if(!function_exists("isActive")) {
    /**
     * @param $url
     * @return string
     */
    function isActive($url) {
        return $_SERVER['REQUEST_URI'] == $url ? 'active' : '';
    }
}

16th July, 2018

Stank0V01 left a reply on Eloquent, Make Items Upgradable • 1 month ago

ok

Stank0V01 left a reply on Eloquent, Make Items Upgradable • 1 month ago

@topvillas Can explain what current i must do?

Stank0V01 left a reply on Eloquent, Make Items Upgradable • 1 month ago

I don't think that? :D i just want some answear like all users here

Stank0V01 left a reply on Eloquent, Make Items Upgradable • 1 month ago

So now can i bump?

15th July, 2018

Stank0V01 left a reply on Eloquent, Make Items Upgradable • 1 month ago

@Cronix , ok i sorry, so someone give me smth about question

Stank0V01 left a reply on Eloquent, Make Items Upgradable • 1 month ago

bump

Stank0V01 started a new conversation Eloquent, Make Items Upgradable • 1 month ago

Hello i have some idea to ranks be upgradable! So i have categories products and orders!

So i want to make something like this

First i will give you some code and migrations:

Product structure:

        Schema::create('products', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('description');
            $table->unsignedInteger('recommended');
            $table->integer('price');
            $table->string('image');
            $table->unsignedInteger('required_product_id')->nullable();
            $table->unsignedInteger('max_buys');
            $table->integer('discount')->nullable();
            $table->timestamps();
        });

Orders structure:

        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id')->unique();
            $table->integer('product_id');
            $table->integer('user_id');
            $table->timestamps();
        });

So i will explain what column : required_product_id column must have id of product that must purchase first to purchase it! Second is max_buys

if max_buys is 1 product can be buyable only once , if its 0 it can purchased many times that i want.

If you want some example: http://iplexmc.eu/p/1 (It will ask you for username enter some random username and click here http://prntscr.com/k6qzby

(All products are in only category so it is hasMany rel)

CategoriesController.php

namespace App\Http\Controllers;

use App\Product;
use Illuminate\Http\Request;
use App\Category;
use App\User;
use App\Order;
use Illuminate\Support\Facades\DB;

class CategoriesController extends Controller
{
    /**
     * @param Category $category
     * @param User $user
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function showProducts(Category $category, User $user)
    {
        $products = $category->products();


        return view('products.category',['extras'=>$extras]);


    }
}

Please help me , i don't know how to do that (I want products var to return and producta that be only once purchased) (When user purchase rank that is onlyOnce it will removed from the list)

Stank0V01 left a reply on Laravel Paypal IPN • 1 month ago

@nnayeem no!

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

I fuck'up my brain :D with that query :d i thinking to not make it with upgrades @Tray2 Its way easy to use eloquent so for that i use laravel

Stank0V01 left a reply on UNION MySQL, Check If Its Bold • 1 month ago

bump

Stank0V01 started a new conversation UNION MySQL, Check If Its Bold • 1 month ago

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

It not work with DISTINCT

SELECT p.* FROM products p WHERE required_product_id IS NULL 
UNION 
SELECT  p.* FROM products p, orders o WHERE p.required_product_id = o.product_id 
AND o.user_id = 1
UNION DISTINCT
SELECT p.`*` FROM products p, orders o WHERE p.id NOT IN (SELECT product_id FROM orders WHERE product_id = p.id AND o.user_id = 1)
AND p.max_buys = 1;

http://prntscr.com/k6od0q @Tray2

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

:D Now the most hard thing is how to make not row duplicate

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

@Tray2 it get syntax error on last where

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

SELECT p.* FROM products p WHERE required_product_id IS NULL 
UNION ALL
SELECT p.* FROM products p, orders o WHERE p.required_product_id = o.product_id 
AND o.user_id = 1
UNION ALL
SELECT p.* FROM products p, orders o WHERE p.max_buys = 0

I make that query but it return that

http://prntscr.com/k6o065

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

So sql must be that

@Tray2


SELECT p.* from Products p where required_product_id IS NULL 

UNION ALL

SELECT p.* FROM products p orders o WHERE p.required_product_id = o.product_d
AND o.user_id = 1 

UNION ALL

SELECT p.* FROM products p where p.max_buys = 1 

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

Ok, but i have problem with supplied can you give me query? Cuz i have table and union is might difficult to understand to me @Tray2

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

Products: http://prntscr.com/k6mbx4, Orders: http://prntscr.com/k6mbzv only_once: http://prntscr.com/k6mc1p

So when user buy the rank current purchased rank to remove from list and display anotherone but if onlyOnce is set to N current purchased rank to not remove from list!

@Tray2

14th July, 2018

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

I hope tommorow u will help mu cuz i very need that option to added in my site

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

SELECT p.*, "Y", onlyOnce
  FROM products p 
  WHERE required_product IS NULL 
  UNION ALL
  SELECT p.*, "Y", onlyOnce
  FROM products p, orders o 
  WHERE p.required_product = o.product_id 
  AND o.user_id = 1 UNION ALL
SELECT p.* , "onlyOnce","Y"
FROM products p, orders o, only_once once
WHERE p.required_product = o.product_id
AND p.id = once.product_id
AND p.id NOT IN (SELECT product_id FROM orders WHERE o.product_id = p.id and o.user_id=1) 

I change it to that cuz my colum onlyOnce in products must be Y/N and i make another table called only_once with user and product_id but i have problem it display same thing like before? :D if i add in orders it will unlock next and not hide current ;( i want to make it purchasable only once

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

@Tray2 i change it to this way:

       $extras = DB::select(

            'SELECT p.*
  FROM products p 
  WHERE required_product IS NULL 
  UNION ALL
  SELECT p.* 
  FROM products p, orders o 
  WHERE p.required_product = o.product_id 
  AND o.user_id =' .  $user->id .  'UNION ALL
  SELECT p.* , "onlyOnce" product_type
  FROM products p, orders o, only_once on 
  WHERE p.required_products = o.product_id
  AND p.id = on.product_id 
  AND p.id NOT IN (SELECT product_id FROM orders WHERE o.product_id = p.id and o.user_id ='.$user->id);

Still return that:

http://9af1104f.ngrok.io

I give u my host link to check what it come from

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

@Tray2 hhttp://prntscr.com/k6hsut This is my table

This is my changed code

        $extras = DB::select(

            'SELECT p.*
  FROM products p 
  WHERE required_product IS NULL 
  UNION ALL
  SELECT p.* 
  FROM products p, orders o 
  WHERE p.required_product = o.product_id 
  AND o.user_id =' .  $user->id .  'UNION ALL
  SELECT p.* , "onlyOnce" product_type
  FROM products p, orders o, only_once on 
  WHERE p.required_products = o.product_id
  AND p.id = on.product_id 
  AND p.id NOT IN (SELECT "x" FROM orders WHERE o.product_id = p.id and o.user_id ='.$user->id);

What im doing wrong cuz it give me error?

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

@Tray2 I must do it like this

|id|name|desc|bla|bla|product_type 1 name desc .... .... HERE WHAT ?

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

Hm.. Im not sure i can understand that part @Tray2 can you explain more details? Where i must create column cuz if not in my tables where it must be? :D

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

@Tray2 it say it have syntax error! And where is placeholder column?

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

yeah but i want to explain in in same thing with purchasableItems

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

@Tray2 One more question if i want to make this product buyable only once, i have

table onlyOnce they must Y - Yes/N - No and i want when user purchase that to remove from included list

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

Oh, I did it! Thanks for a lot of support dude! You'r awesome!

Stank0V01 left a reply on Check Product Is Purchased , To Unlock Next One! • 1 month ago

Can you explain in code cuz im not very good in english @Tray2

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.