SiavashBamshadnia / Laravel-Source-Encrypter

Laravel and Lumen Source Code Encrypter
MIT License
535 stars 124 forks source link

New migration syntax #23

Open Hoopex opened 1 year ago

Hoopex commented 1 year ago

When, I try to encrypt a migration file

Old syntax

class CreateUserTableextends Migration {
}

Migration works without any issues


New syntax laravel >=8

return new class extends Migration {
};

Migration not working and returning that error Class "CreateUserTable" not found

SiavashBamshadnia commented 1 year ago

Which operating system are you using to develop? Which PHP version?

Hoopex commented 1 year ago

Which operating system are you using to develop? Linux (Ubuntu)

Which PHP version? 8.1

You don't have that issue ?

SiavashBamshadnia commented 1 year ago

Actually I don't use Ubuntu. But I think this error is not related to this package. Try running the original code (without encryption) and see if the error still exists.

Hoopex commented 1 year ago

I think it related to this package because the original source (without encryption) works, but encrypted source I got that error. and to make it work, I have to give manual class name to all migrations

From return new class extends Migration {};

To class CreateUserTable extends Migration {}

SiavashBamshadnia commented 1 year ago

Okay, @Hoopex. Thanks for reporting this problem. I will check it.

SiavashBamshadnia commented 1 year ago

Hello, @Hoopex. Sorry for the late response... I got to install Ubuntu and check the scenario. I installed PHP 8.1 and created a Laravel project with the composer. Then, I installed the sbamtr/laravel-source-encrypter and tried to encrypt the project. Finally, migrations were encrypted without any problem. The migrations were the default ones that those are: https://github.com/laravel/laravel/tree/586b9e7bf5efef4d205552cc285a3f8498767578/database/migrations I think you are using the wrong version of phpbolt.

Hoopex commented 1 year ago

Hi Mr @SiavashBamshadnia

I test that again with fresh laravel project and the I got the same result, and I can confirm that I', using the right phpbolt version.

Hoopex commented 1 year ago

Any updates by any chance ?

SiavashBamshadnia commented 1 year ago

Hello. I think phpbolt does not support anonymous classes. As a result, I created an issue in phpbolt's repository.

jamesRUS52 commented 1 year ago

+1