GithubHelp home page GithubHelp logo

Comments (3)

owenvoke avatar owenvoke commented on June 15, 2024

The output should have a caret (^) before the dump, which will allow you to click through to open the file / line number in your editor. However, if you want to replicate the experience of Laravel exactly, you should be able to add the following to your AppServiceProvider::register() method:

public function register(): void
{
    $basePath = $this->app->basePath();

    \Illuminate\Foundation\Console\CliDumper::register($basePath, null);
}

from laravel-zero.

kocoten1992 avatar kocoten1992 commented on June 15, 2024

Thanks for the code + explaination, but it is not exactly the same yet:

// in laravel-zero + your code in register
// app/Commands/GenerateMatchingSentenceCommand.php
// in laravel
// app/Commands/GenerateMatchingSentenceCommand.php:14

The line number was missing (it was the best part!).

And since this is a really neat feature, do you think it deserve to be in laravel-zero by default?

from laravel-zero.

owenvoke avatar owenvoke commented on June 15, 2024

Ok, that's my bad. I thought the compiled view path could be made null to skip it, however you'll need to use:

public function register(): void
{
    $basePath = $this->app->basePath();

    $compiledViewPath = $this->app['config']->get('view.compiled', \Illuminate\Support\Str::random());

    \Illuminate\Foundation\Console\CliDumper::register($basePath, $compiledViewPath);
}

So the problem is, if the path gets detected as starting with the compiled view path (e.g. '' for when it's null), then the line number gets ignored. If you're not using views at all (for something like Termwind), this path needs to be set to something random instead (like... Str::random(), or sys_get_temp_dir()). Otherwise it will remove the line number from all dumps.

I guess this could be added in to Laravel Zero, it's just a case of ensuring it's clean and won't cause any issues.

from laravel-zero.

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.