Skip to content

Conversation

hailwood
Copy link
Contributor

Introduced make:data-provider console command.
Added support for Laravel Idea.

hailwood and others added 2 commits May 1, 2025 10:19
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @hailwood, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

I've reviewed the pull request and here's a summary. This PR introduces a new make:data-provider console command for Laravel applications, enhancing developer productivity by automating the creation of Inertia data providers. It also adds support for Laravel Idea, a popular IDE helper, by including a configuration file that defines code generation templates for Inertia data providers. This allows developers to quickly scaffold new data providers directly from their IDE.

Highlights

  • New Artisan Command: Introduces make:data-provider artisan command to generate Inertia data providers.
  • Laravel Idea Support: Adds ide.json to provide code generation support for Inertia data providers within Laravel Idea.

Changelog

Click here to see the changelog
  • ide.json
    • Added a configuration file to support code generation for Inertia data providers in Laravel Idea.
    • Defines a code generation template with the ID webfox.create-inertia-data-provider.
    • Specifies the class suffix as DataProvider.
    • Configures the file generation, including the app namespace (Http\DataProviders), file name pattern (${INPUT_CLASS|className|upperCamelCase}.php), and stub template path (/stubs/inertia-data-provider.stub).
    • Defines parameters for the stub template, including class and namespace.
  • src/InertiaDataProviderMakeCommand.php
    • Created a new InertiaDataProviderMakeCommand class extending GeneratorCommand.
    • Registers the command with the name make:data-provider.
    • Sets the command description to 'Create a new inertia data provider'.
    • Overrides the alreadyExists method to check if the data provider already exists.
    • Overrides the getStub method to return the path to the stub file.
    • Implements the resolveStubPath method to resolve the fully-qualified path to the stub.
    • Overrides the getDefaultNamespace method to set the default namespace for the class to rootNamespace.'\Http\DataProviders'.
    • Overrides the getOptions method to define the force option.
  • src/InertiaDataProvidersServiceProvider.php
    • Registers the InertiaDataProviderMakeCommand with the Laravel console.
  • stubs/inertia-data-provider.stub
    • Creates a stub file for generating Inertia data providers.
    • Defines the basic structure of a data provider class, including the namespace, class name, and constructor.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A command to create,
A provider of data's grace,
Inertia's swift flow.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new make:data-provider console command for Laravel, enhancing developer experience by providing a convenient way to generate Inertia data providers. It also adds support for Laravel Idea, which is a welcome addition. The implementation appears to be well-structured and follows Laravel conventions.

Merge Readiness

The pull request introduces a useful feature and integrates well with the existing Laravel ecosystem. I recommend merging this pull request after addressing the review comments. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging.

Comment on lines +18 to +22
protected function alreadyExists($rawName)
{
return class_exists($rawName) ||
$this->files->exists($this->getPath($this->qualifyClass($rawName)));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a more descriptive check to alreadyExists. Currently, it only checks if the class exists or if the file exists. It might be beneficial to add a check to see if a data provider with the same name already exists in the specified namespace. This could prevent potential naming conflicts and improve the developer experience.

        return class_exists($rawName) ||
            $this->files->exists($this->getPath($this->qualifyClass($rawName)));

@hailwood hailwood merged commit 5a4d0e2 into main Apr 30, 2025
1 check passed
@hailwood hailwood deleted the feature/make-command branch April 30, 2025 22:23
@hailwood hailwood mentioned this pull request Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant