Giter Site home page Giter Site logo

Comments (8)

bastinald avatar bastinald commented on May 28, 2024

Thank you for your work! While this was designed with Mac & Linux, I want to ensure it works for people on Windows too.

I'll be implementing the fixes you mentioned shortly.

from laravel-livewire-ui.

bastinald avatar bastinald commented on May 28, 2024

Can you confirm everything else is working fine aside from the CRUD command?

It's kind of a pain in the ass to set up Laragon on Parallels...

from laravel-livewire-ui.

bastinald avatar bastinald commented on May 28, 2024

Should work on Windows now as of version 2.1.5

from laravel-livewire-ui.

Thiktak avatar Thiktak commented on May 28, 2024

Not fixed :(

S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3>php artisan make:crud Test/TestA                                                                                                                                          
Bastinald\LaravelLivewireUi\Commands\MakeCrudCommand::setReplaces                                                                                                                                                                   
Bastinald\LaravelLivewireUi\Commands\MakeCrudCommand::makeStubs                                                                                                                                                                     
makeStubs: S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\app/Http/Livewire//Test/TestAs/Index.php\Index.php                                                                                                             
File created: app/Http/Livewire//Test/TestAs/Index.php\Index.php                                                                                                                                                                    
makeStubs: S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\app/Http/Livewire//Test/TestAs/Index.php\Read.php                                                                                                              
File created: app/Http/Livewire//Test/TestAs/Index.php\Read.php                                                                                                                                                                     
makeStubs: S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\app/Http/Livewire//Test/TestAs/Index.php\Save.php                                                                                                              
File created: app/Http/Livewire//Test/TestAs/Index.php\Save.php                                                                                                                                                                     
makeStubs: S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\resources\views/test\test-as\index.blade.php  

The makestubs is still try to create a file as a folder. Results:
./Test/TestAs/index.php/index.blade.php

The responsible is:

        $this->componentDir = Str::replaceLast(
            DIRECTORY_SEPARATOR . 'index.php',
            '',
            $this->componentParser->relativeClassPath()
        );

Indeed, it return a file, because it's not removing the Index.php due to namespace separator and not directory separator. Need to sanitize to handle the two / & .
DIRECTORY_SEPARATOR = ""
$this->componentParser->relativeClassPath() = "app/Http/Livewire//Test/TestAs/Index.php"

At the end:

        $this->componentDir = $this->componentParser->relativeClassPath();
        $this->componentDir = Str::replaceLast('\Index.php', '', $this->componentDir);
        $this->componentDir = Str::replaceLast('/Index.php', '', $this->componentDir);

and, bacause I still have the joining of paths:

            $basePath = base_path(str_replace(base_path(), '', $path));

And by the way, now I have another error:
file_put_contents(S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\app/Database/Factories//TestAFactory.php): Failed to open stream: No such file or director

The error is comming from MakeAModelCommand $this->factoryParser. An extra / is added at the baseClassPath (I don't understand why !)

  +"baseClassNamespace": "Database\Factories"                                                                                                                                                                                       
  +"baseTestNamespace": "Tests\Feature\Livewire"                                                                                                                                                                                    
  +"baseClassPath": "S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\app/Database/Factories//"                                                                                                                            
  +"baseViewPath": "S:\Devs\xampp\htdocs\www\projects\p4_lv8_my_work\my_work3\resources\views/"                                                                                                                                     
  +"baseTestPath": "S:/Devs/xampp/htdocs/www/projects/p4_lv8_my_work/my_work3/tests/Feature/Livewire/" 

My current fix:

    private function replaceFactoryPath($method)
    {
        return str_replace(
            '//',
            '/',
            Str::replaceFirst(
                'app/Database/Factories',
                'database' . DIRECTORY_SEPARATOR . 'factories',
                $this->factoryParser->$method()
            )
        );
    }

from laravel-livewire-ui.

bastinald avatar bastinald commented on May 28, 2024

Are you using all of the latest versions of all packages?

Can you run composer update and try again? I thought I had all this stuff fixed.

If it still persists after running composer update I'll see what I can do.

I might have to bite the bullet and actually install Windows lol.

from laravel-livewire-ui.

Thiktak avatar Thiktak commented on May 28, 2024

Hi,

Yes. Used composer update. And even the fresh install.
I saw lot of DIRECTORY_SEPARATOR in you last commits. But I guess, sometimes you have namespace separator ( \ ) logic, and there is a mix between them.

(here it's more linked to the migration package)
2021-07-02 11_48_30-(WWW) - Sublime Text (UNREGISTERED)
(still // and still the app directory path on the replaceFactoryPath function)

I fixed, and tried to create a CRUD.

Again:
2021-07-02 11_53_41-(WWW) - Sublime Text (UNREGISTERED)

from laravel-livewire-ui.

bastinald avatar bastinald commented on May 28, 2024

Can you composer update to version 2.1.3 of the migration package and try creating a model via the make:amodel command? I made some more changes and hope it works.

If you could add me on discord bastinald#3568 so we can do this together so I don't have to install Windows that would help...

from laravel-livewire-ui.

bastinald avatar bastinald commented on May 28, 2024

Closing this as its now fixed.

from laravel-livewire-ui.

Related Issues (7)

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.