laravel-shift / blueprint

A code generation tool for Laravel developers.
MIT License
2.83k stars 271 forks source link

Separated enum values are not working well #610

Closed muath-ye closed 1 year ago

muath-ye commented 1 year ago

Issue:

I have this array of enum Invoice,Credit Note,Quote,Purchase Order,Receipt and I can not pass it to the yaml file

draft.yaml:

models:
  Bill:
    currency: string nullable
    type: enum:Invoice,Credit Note,Quote,Purchase Order,Receipt nullable

output on the migration file


// ...
Schema::create('invoiceas', function (Blueprint $table) {
            $table->id();
            $table->string('currency')->nullable();
            $table->enum('type', ["Invoice","Credit"])->nullable();
// ...
ghostwriter commented 1 year ago

Hey @muath-ye,

The cause of the issue is the space ( ) in "Credit Note", another one in "Purchase Order".

If I remember correctly (#103 & #347), you can use single-quotes (') or double-quotes (") to achieve your goal.

type: enum:Invoice,'Credit Note',Quote,'Purchase Order',Receipt nullable

or

type: enum:Invoice,"Credit Note",Quote,"Purchase Order",Receipt nullable

let us know if that’s helpful/works, if not we'll take a closer look.