Giter Club home page Giter Club logo

Comments (7)

farismohammed avatar farismohammed commented on July 29, 2024 1

Thank you .. problem solved.

from laravel-eloquent-join.

 avatar commented on July 29, 2024 1

Thank you verymuch

from laravel-eloquent-join.

fico7489 avatar fico7489 commented on July 29, 2024

1.can you paste error you get?
2.can you paste your role relation code in user model ? is it role or roles, because if it is roles then :

$query ->orWhereJoin('roles.name', '=', 'user');

from laravel-eloquent-join.

 avatar commented on July 29, 2024

I have a query which is working with orWhere, but if I use orWhereJoin instead of it getting an error

Query - Laravel (orWhere)

            DeviceModel::where(function ($query) {
                      $query ->orWhere('device_company_name', '=', 'samsung');
                      $query ->orWhere('device_company_name', '=', 'mi');
            })
            ->where('id', '!=', '1')
            ->get();

Query - Laravel-eloquent-join (orWhereJoin)

DeviceModel::where(function ($query) {
                      $query ->orWhereJoin('deviceCompany.name', '=', 'samsung');
                      $query ->orWhereJoin('deviceCompany.name', '=', 'mi');
            })
            ->where('id', '!=', '1')
            ->get();

DeviceModel relationship

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;

class DeviceModel extends Model
{
    use SoftDeletes;
    use EloquentJoin;
    //
    protected $dates = ['deleted_at'];

    public function deviceCompany(){
    	return $this->belongsTo('App\DeviceCompany');
    }
}

ERROR

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'device_companies.name' in 'where clause' (SQL: select * from device_models where (device_companies.name = samsung or device_companies.name = mi) and id != 1 and device_models.deleted_at is null)

from laravel-eloquent-join.

farismohammed avatar farismohammed commented on July 29, 2024

@fico7489 facing the same problem... any solution..???

from laravel-eloquent-join.

fico7489 avatar fico7489 commented on July 29, 2024

Here is a fix for the issue : https://github.com/fico7489/laravel-eloquent-join/pull/28/files
It will be merged soon.

from laravel-eloquent-join.

fico7489 avatar fico7489 commented on July 29, 2024

merged

from laravel-eloquent-join.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.