🧩 Laravel Query Builder integration for PhpStorm

Overview

Laravel Query

Build Version Downloads

Laravel + DataGrip = ♥️

Demo

This plugin provides database integration for Laravel query builder.

Features

  • Schemas, tables, views and columns completion for query builder methods
  • Inspection of unknown database elements
  • Table alias support
  • Table name resolving from model for eloquent builder methods
  • Model relation table name resolving for eloquent builder relation closure methods
  • Text linking with database elements for navigation and refactoring

Prerequisites

Connect your database

See https://www.jetbrains.com/help/phpstorm/connecting-to-a-database.html#connect-to-mysql-database for instructions.

Laravel tools

You also need either Laravel Idea plugin (paid) or Laravel IDE helper added to your project and run

php artisan ide-helper:generate
php artisan ide-helper:meta
php artisan ide-helper:models
php artisan ide-helper:eloquent

which will generate some helper files so your IDE could see Eloquent methods.

Laravel Query plugin needs either of those to work otherwise, it cannot understand for which methods to trigger autocompletion.

Future plans

  • Improve schema builder support to read current migration file as well instead of just table from database
  • Add morph columns support for schema builder integration
  • Improve sorting

Installation

  • Using IDE built-in plugin system:

    Preferences > Plugins > Marketplace > Search for "Laravel Query" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Preferences > Plugins > ⚙️ > Install plugin from disk...


Plugin based on the IntelliJ Platform Plugin Template.

Comments
  • Unknown column since latest update

    Unknown column since latest update

    Hello, since the last update i keep getting unknown column even though i'm sure that i have the datasource added and even selected the database i want for the query in settings.. image

    opened by Ahmed-Elrayes 14
  • Not compatible with EAP

    Not compatible with EAP

    Nice to see you got a version ready for testing 👍

    I have a problem with not being able to install it on EAP versions, as the current EAP is 2021.1 😃

    opened by olivernybroe 6
  • [Feature Request]: Add support for Model::fill()

    [Feature Request]: Add support for Model::fill()

    Feature Description I would like to have a possibility to have an autocompletion (with inspection "Unknown column") on the fill and forceFill methodes.

    Is this already supported and I'm missing some settings, or isn't it implemented (for now 😉)?

    question 
    opened by LWlook 4
  • Plugin not working correctly with aliases (select, join, orderBy)

    Plugin not working correctly with aliases (select, join, orderBy)

    If having a model Profile like:

    <?php
    
    namespace App\Models;
    
    use App\Model;
    use Eloquent;
    use Illuminate\Database\Eloquent\Relations\BelongsTo;
    
    /**
     * @package App\Models
     * @mixin Eloquent
     */
    class City extends Model
    {
        public function state(): BelongsTo
        {
            return $this->belongsTo(State::class);
        }
    }
    

    Then highlighting would look like the screenshot below:

    CleanShot 2022-02-22 at 13 22 38@2x bug 
    opened by CristianSitov 4
  • Warning on alias

    Warning on alias

    hello. image example warning on alias table. Maybe I'm doing something wrong? phpStorm latest. plugin updated. autocomplete on alias work perfectly image problem only inside "leftJoin" image

    bug question 
    opened by time4dev 4
  • Different references for the same PsiElement throws

    Different references for the same PsiElement throws "Non-idempotent computation" exception

    java.lang.Throwable: Non-idempotent computation: it returns different results when invoked multiple times or on different threads:
      1 != 2
      which is length of [com.laravel_idea.plugin.eloquent.b.d@4cce9a9a] and [dev.ekvedaras.laravelquery.reference.ColumnPsiReference(StringLiteralExpressionImpl: 'vip':(1,4)), com.laravel_idea.plugin.eloquent.b.d@6a5ef7c8]
    
    Recomputation gives com.intellij.util.CachedValueBase$Data@309762ce which is equivalent to 'fresh'
    Recomputation log:
      dev.ekvedaras.laravelquery.reference.ColumnReferenceProvider@11ecc6a8 returned [dev.ekvedaras.laravelquery.reference.ColumnPsiReference(StringLiteralExpressionImpl: 'vip':(1,4))]
      com.laravel_idea.plugin.a.b@15486265 returned [com.laravel_idea.plugin.eloquent.b.d@2d6a201c]
    	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:161)
    	at com.intellij.util.IdempotenceChecker.reportFailure(IdempotenceChecker.java:90)
    	at com.intellij.util.IdempotenceChecker.checkEquivalence(IdempotenceChecker.java:77)
    	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:237)
    	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
    	at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:72)
    	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:155)
    	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:121)
    	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:38)
    	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:31)
    	at com.jetbrains.php.lang.psi.elements.impl.StringLiteralExpressionImpl.getReferences(StringLiteralExpressionImpl.java:432)
    	at com.laravel_idea.plugin.extension.inspections.LaravelUnknownViewInspection$buildVisitor$1.visitPhpStringLiteralExpression(LaravelUnknownViewInspection.kt:32)
    

    When my plugin asks for references for the StringLiteralExpression element this error appears. As you see, one time your plugin adds references for this element, another time - doesn't.

    Actually, I have a lot of these issues: https://github.com/laravel-idea/plugin/issues/296 https://github.com/laravel-idea/plugin/issues/262

    I wanted to make a PR here, but couldn't understand this code: if (isResolving.contains(element)) {. I'm sure this is the reason for these exceptions.

    bug 
    opened by adelf 4
  • Unable to select a data source in the plugin UI

    Unable to select a data source in the plugin UI

    After a recent update of the plugin, I get the notification bubble prompting me to choose a data source, which takes me to this window:

    Screenshot 2021-09-29 at 11 22 48

    However, clicking anywhere in the list does... absolutely nothing. I can't tick any of the boxes, or order/sort any of the columns. I can resize them, but that's the only interaction I can see to do with the window.

    There's no errors or beeps — just appears to be totally non-responsive. I've tried invalidating caches + restarting, but it makes no difference.

    (This issue aside, thanks for a great plugin!)

    opened by JackWH 3
  • `Model::create([])` completion

    `Model::create([])` completion

    So in the end the inspection and completion work as they should.

    Model::create([
        '<caret>' => 'value',
    ])
    

    However, as we're writing the code we get this:

    Model::create([
        'id' => 1,
        '<caret>'
    ]);
    

    Technically caret is now inside array value and we don't want to complete in array values here, but we are actually writing a column at that moment. So, this needs to be somehow detected properly.

    opened by ekvedaras 3
  • Bump org.jlleitschuh.gradle.ktlint from 10.0.0 to 10.1.0

    Bump org.jlleitschuh.gradle.ktlint from 10.0.0 to 10.1.0

    Bumps org.jlleitschuh.gradle.ktlint from 10.0.0 to 10.1.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 3
  • ClassCastException happended

    ClassCastException happended

    This exception happened for me. I didn't see anything break though 👍

    Stacktrace
    java.lang.ClassCastException: class com.intellij.psi.impl.source.tree.LeafPsiElement cannot be cast to class com.jetbrains.php.lang.psi.elements.impl.GroupStatementImpl (com.intellij.psi.impl.source.tree.LeafPsiElement is in unnamed module of loader com.intellij.util.lang.PathClassLoader @6b2fad11; com.jetbrains.php.lang.psi.elements.impl.GroupStatementImpl is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @493c9a13)
    	at dev.ekvedaras.laravelquery.utils.ModelRelationResolver.resolveRelationTable(ModelRelationResolver.kt:40)
    	at dev.ekvedaras.laravelquery.utils.ModelRelationResolver.resolveModelAndRelationTables(ModelRelationResolver.kt:31)
    	at dev.ekvedaras.laravelquery.utils.TableAndAliasCollector.collect(TableAndAliasCollector.kt:38)
    	at dev.ekvedaras.laravelquery.models.DbReferenceExpression$2.run(DbReferenceExpression.kt:49)
    	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:814)
    	at dev.ekvedaras.laravelquery.models.DbReferenceExpression.<init>(DbReferenceExpression.kt:48)
    	at dev.ekvedaras.laravelquery.models.DbReferenceExpression.<init>(DbReferenceExpression.kt:15)
    	at dev.ekvedaras.laravelquery.inspection.UnknownColumnInspection$buildVisitor$1.visitPhpStringLiteralExpression(UnknownColumnInspection.kt:42)
    	at com.jetbrains.php.lang.psi.elements.impl.StringLiteralExpressionImpl.accept(StringLiteralExpressionImpl.java:36)
    	at com.jetbrains.php.lang.psi.elements.impl.PhpPsiElementImpl.accept(PhpPsiElementImpl.java:73)
    	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:65)
    	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:346)
    	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:174)
    	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:132)
    	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:121)
    	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:111)
    	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$10(LocalInspectionsPass.java:346)
    	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
    	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
    	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
    	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
    	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1091)
    	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
    	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
    	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
    	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
    	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:167)
    	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:178)
    	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
    	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:61)
    	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:49)
    	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitRestElementsAndCleanup(LocalInspectionsPass.java:366)
    	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:208)
    	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:119)
    	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
    	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
    	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
    	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1096)
    	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
    	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
    	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
    	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
    	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:167)
    	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:178)
    	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
    	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
    	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
    
    opened by olivernybroe 3
  • build(deps): bump io.gitlab.arturbosch.detekt from 1.18.1 to 1.19.0

    build(deps): bump io.gitlab.arturbosch.detekt from 1.18.1 to 1.19.0

    Bumps io.gitlab.arturbosch.detekt from 1.18.1 to 1.19.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • custom table name

    custom table name

    Hello it's not auto-complete when I use the custom table name

    class Members extends Model
    {
        use HasFactory;
        protected $table = "members_list";
    }
    

    Untitled-1

    thanks

    bug help wanted 
    opened by amrdesign 1
Releases(v4.0.1)
Owner
Ernestas Kvedaras
Code is art
Ernestas Kvedaras
Magento 2 Debug Helper Module for easy debugging with Xdebug and PHPStorm or any other IDE

Magento 2 Debug Helper Information and Usage Magento 2 Debug Helper Module usage with PHPStorm and Xdebug Installation To install the Magento 2 Debug

Dmitry Shkoliar 13 May 24, 2022
PHPStorm Magento 2 File Templates

phpstorm-m2-filetemplates PHPStorm Magento 2 File Templates Useful file templates for working with Magento 2. To install, place the files directly in

Laura Folco 39 Dec 21, 2022
PHPStorm Live template preferences for Magento 2 Projects

Magento 2 PHPStorm Preferences This project is intended to setup useful PHPStorm Templates for Magento 2 Projects. Disclaimer This project overrides t

Stämpfli AG 229 Jul 18, 2022
PHPStorm Plugin for Magento 2

PhpStorm Magento 2 Plugin Installation Go to Settings > Preferences in the PhpStorm IDE Navigate to Plugins Click the Browse repositories... button an

Magento 395 Dec 21, 2022
Minimalistic Light colour scheme for PhpStorm

A minimalistic light colour scheme for PhpStorm If you need convincing of a light colour scheme, I'd like to direct you to a post on the topic. Colour

Brent Roose 269 Dec 24, 2022
Simple JQL builder for Jira search

Jql Builder Simple JQL builder for Jira search Installation composer require devmoath/jql-builder Usage Generate query with one condition: \DevMoath\J

Moath 11 Jan 2, 2023
A visual process builder

DataStory ⚡ visual programming DataStory provides a workbench for designing data flow diagrams. ⚠️ We have moved to an organisation ?? Live Demo data-

Anders Jürisoo 120 Dec 12, 2022
Bundle providing Honeypot field for the Form Builder in Ibexa DXP Experience/Commerce (3.X)

IbexaHoneypot Bundle providing Honeypot field for the Form Builder in Ibexa DXP Experience/Commerce (3.X) What is Honey pot? A honey pot trap involves

null 1 Oct 14, 2021
Phalcon Builder - is a packaging system that make it easy and quick to build Phalcon packages such as rpms, debs, etc. Phalcon's distribution that hosted at PackageCloud.

Phalcon Builder - is a packaging system that make it easy and quick to build Phalcon packages such as rpms, debs, etc. Phalcon's distribution that hos

The Phalcon PHP Framework 26 Oct 7, 2022
Drupal Composer Scaffold - A flexible Composer project scaffold builder

This project provides a composer plugin for placing scaffold files (like index.php, update.php, …) from the drupal/core project into their desired location inside the web root. Only individual files may be scaffolded with this plugin.

Drupal 44 Sep 22, 2022
FFCMS 3 version core MVC architecture. Build-on use with ffcms main architecture builder.

FFCMS 3 version core MVC architecture. Build-on use with ffcms main architecture builder.

FFCMS 0 Feb 25, 2022
🎨 Free custom elements for the WordPress Theme Bricks Builder.

?? Custom Elements for Bricks Builder Free custom elements for Bricks, the visual site builder for WordPress. If you find the elements useful, click o

Simon Vidman 33 Dec 13, 2022
QueryHandler - Handling PDO ' s query with mySQL database

QueryHandler this class's method are static .... that mean you don't need to create an object to use it . All methodes will return an Exception if it

null 7 Aug 9, 2022
JsonQ is a simple, elegant PHP package to Query over any type of JSON Data

php-jsonq JsonQ is a simple, elegant PHP package to Query over any type of JSON Data. It'll make your life easier by giving the flavour of an ORM-like

Nahid Bin Azhar 834 Dec 25, 2022
Bastion API is a simple API made to get query informations

Bastion API is a simple API made to get query informations

Adler 1 Jul 16, 2022
Provides an object-oriented API to query in-memory collections in a SQL-style.

POQ - PHP Object Query Install composer require alexandre-daubois/poq 1.0.0-beta2 That's it, ready to go! ?? Usage Here is the set of data we're going

Alexandre Daubois 16 Nov 29, 2022
Personal PHP MySQL query handler based on Eloquent using PDO.

?? Equivoluent Welcome to "Equivoluent" my personal PHP MySQL query handler using PDO. Equivoluent is based on Laravel's Eloquent. The goal of "Equivo

Wob Jelsma 2 Sep 7, 2022
Laravel Nova integration for justbetter/laravel-magento-customer-prices

Laravel Magento Customer Prices Nova Laravel Nova integration for justbetter/laravel-magento-customer-prices. Installation Install the package. compos

JustBetter 13 Nov 4, 2022
Laravel Nova integration for justbetter/laravel-magento-prices

Laravel Magento Prices Nova This package is the Laravel Nova integration for justbetter/laravel-magento-prices. Installation Install the package. comp

JustBetter 15 Nov 29, 2022