GithubHelp home page GithubHelp logo

1.1.8 Issue about laravel-follow HOT 21 CLOSED

overtrue avatar overtrue commented on June 9, 2024
1.1.8 Issue

from laravel-follow.

Comments (21)

davisriska avatar davisriska commented on June 9, 2024 1

Im sadly having the same issue, as Im also using MSSQL. Locking the version on 1.1.7 for now. If only I could use MySQL I would. 😢
@snazy2000 If you find a solution, please be so kind and post it here! 😅

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

What db engine are you used?

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

https://dev.mysql.com/doc/refman/8.0/en/working-with-null.html

IS NOT NULL is a valid mysql syntax.

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

I got the reason. Sorry, I will fix that as soon as possible.

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

@snazy2000 Plz take a try with master branch, plz let me know if it works.

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

Hi @overtrue

I have just tried the fix and unfortunately still same error.

It doesn't look like what your doing there is supported in MSSQL

Stephen

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

https://stackoverflow.com/questions/14962970/sql-query-if-value-is-null-then-return-1

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

@snazy2000 Please paste the SQL.

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

select [users].*, [pivot_followables].[user_id] IS NOT NULL as [pivot_each_other], [followables].[followable_id] as [pivot_followable_id], [followables].[user_id] as [pivot_user_id], [followables].[followable_type] as [pivot_followable_type], [followables].[relation] as [pivot_relation], [followables].[created_at] as [pivot_created_at] from [users] inner join [followables] on [users].[id] = [followables].[user_id] left join [followables] as [pivot_followables] on [pivot_followables].[followable_type] = 'App\Suggestion' and [pivot_followables].[followable_id] = [followables].[user_id] and [pivot_followables].[user_id] = [followables].[followable_id] where [followables].[followable_id] = 1066 and [followables].[followable_type] = App\Suggestion and [followables].[relation] = follow

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

@snazy2000 I am sorry, I have not SQL Server environment, So, plz do you best to debug and fix this problem, or use MySQL. Let me know if you resolved the bug. Thanks.

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

Can you advise what the need for the IS NOT NULL at that point?
If I remove it shows NULL in that field
Im used to the IS NOT NULL within the Where statements

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

@snazy2000 #63 He want to get the follow each other state.

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

@overtrue are you expecting this result

IF NOT NULL then set field = 1
IF NULL then set field = 0 ?

Or am I miss understanding?

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

If the above is correct then this should work?

(CASE WHEN [pivot_followables].[user_id] IS NOT NULL THEN 1 ELSE 0 END) as [pivot_each_other],

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

Yes, but is it compatible with MySQL?

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

@snazy2000 plz take a try with master branch.

from laravel-follow.

snazy2000 avatar snazy2000 commented on June 9, 2024

No More errors! :) See query below

select [users].*, (CASE WHEN [pivot_followables].[user_id] IS NOT NULL THEN 1 ELSE 0 END) as [pivot_each_other], [followables].[followable_id] as [pivot_followable_id], [followables].[user_id] as [pivot_user_id], [followables].[followable_type] as [pivot_followable_type], [followables].[relation] as [pivot_relation], [followables].[created_at] as [pivot_created_at] from [users] inner join [followables] on [users].[id] = [followables].[user_id] left join [followables] as [pivot_followables] on [pivot_followables].[followable_type] = 'App\Suggestion' and [pivot_followables].[followable_id] = [followables].[user_id] and [pivot_followables].[user_id] = [followables].[followable_id] where [followables].[followable_id] = '1095' and [followables].[followable_type] = 'App\Suggestion' and [followables].[relation] = 'follow'

from laravel-follow.

overtrue avatar overtrue commented on June 9, 2024

😆

from laravel-follow.

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.