Skip to content
Open
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ This package is designed to **accelerate API development** in Laravel by providi

---

## 📽️ Demo

[![Watch the demo]](https://www.loom.com/share/631c4dbc840d475ea4516a8dafcc5b80)

## 🖥️ Usage

1. **Access the UI**
Expand Down
14 changes: 4 additions & 10 deletions resources/views/components/add-files-methods.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</div>
<div class="mb-2">
<label class="flex items-center">
<input type="checkbox" class="form-checkbox h-4 w-4 text-red-500" wire:model.live="is_policy_file_added">
<span class="ml-2 text-sm">Policy</span>
<input type="checkbox" class="form-checkbox h-4 w-4 text-red-500" wire:model.live="is_select_all_files_checked">
<span class="ml-2 text-sm">Select All Files</span>
</label>
</div>
</div>
Expand All @@ -42,14 +42,8 @@
</div>
<div class="mb-2">
<label class="flex items-center">
<input type="checkbox" class="form-checkbox h-4 w-4 text-red-500" wire:model.live="is_notification_file_added">
<span class="ml-2 text-sm">Notification</span>
</label>
</div>
<div class="mb-2">
<label class="flex items-center">
<input type="checkbox" class="form-checkbox h-4 w-4 text-red-500" wire:model.live="is_select_all_files_checked">
<span class="ml-2 text-sm">Select All Files</span>
<input type="checkbox" class="form-checkbox h-4 w-4 text-red-500" wire:model.live="is_policy_file_added">
<span class="ml-2 text-sm">Policy</span>
</label>
</div>
</div>
Expand Down
41 changes: 30 additions & 11 deletions resources/views/components/add-new-field-modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div wire:show="isAddFieldModalOpen" x-data x-cloak x-transition.duration.200ms
<div wire:show="isAddFieldModalOpen" x-data="{ isEnumOrSet: $wire.entangle('data_type').live }" x-cloak x-transition.duration.200ms
x-on:click.self="$wire.isAddFieldModalOpen=false"
class="fixed top-0 left-0 flex items-center justify-center w-full h-full bg-gray-500 bg-opacity-50 z-50">
<x-code-generator::modal :modalTitle="$isEditing ? 'Update Field' : 'Add Field'">
Expand All @@ -20,15 +20,25 @@ class="w-full border rounded-md p-2 placeholder:text-gray-400 placeholder:text-[
</div>

<!-- Data Type -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Data Type</label>
<select id="column_type" class="w-full border rounded-md p-2" name="data_type"
wire:model.live="data_type">
<x-code-generator::data-type-option />
</select>
@error('data_type')
<span class="text-red-600 text-sm">{{ $message }}</span>
@enderror
<div class="flex items-start">
<div class="w-1/2">
<label class="block text-sm font-medium text-gray-700 mb-1">Data Type</label>
<select id="column_type" class="w-full border rounded-md p-2" name="data_type"
wire:model.live="data_type">
<x-code-generator::data-type-option />
</select>
@error('data_type')
<span class="text-red-600 text-sm">{{ $message }}</span>
@enderror
</div>

<!-- Enum Values Textbox -->
<div class="w-1/2 ml-4" x-show="isEnumOrSet === 'enum' || isEnumOrSet === 'set'">
<label class="block text-sm font-medium text-gray-700 mb-1">Enum/Set Values</label>
<input type="text" placeholder="e.g., value1,value2,value3" wire:model.live="enum_values"
class="w-full border rounded-md p-2 placeholder:text-gray-400 placeholder:text-[16px]" />
<p class="text-xs italic text-gray-500 mt-1">Enter comma-separated values for ENUM or SET.</p>
</div>
</div>

<!-- Validation -->
Expand All @@ -47,6 +57,16 @@ class="w-full border rounded-md p-2 placeholder:text-gray-400 placeholder:text-[
@enderror
</div>

<div>
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.live="is_fillable" class="form-checkbox text-indigo-600" checked />
<span class="text-sm text-gray-800">Add in Fillables?</span>
</div>
@error('is_fillable')
<span class="text-red-600 text-sm">{{ $message }}</span>
@enderror
</div>

<!-- Foreign Key Option -->
<div>
<div class="flex items-center gap-2">
Expand All @@ -58,7 +78,6 @@ class="w-full border rounded-md p-2 placeholder:text-gray-400 placeholder:text-[
@enderror
</div>


@if ($this->is_foreign_key)

<div class="bg-white border border-gray-200 rounded-2xl shadow-md p-6 mt-6">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/button.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
])

@php
$buttonColor = in_array($title, ['Reset', 'Cancel','Delete']) ? 'bg-red-500' : 'bg-blue-500';
$buttonColor = $title === 'Cancel' ? 'bg-gray-500': (in_array($title, ['Reset', 'Delete']) ? 'bg-red-500' : 'bg-blue-500');
@endphp

<button {{ $attributes->merge(['class' => $buttonColor . ' text-white py-2 pl-3 pr-4 rounded-lg flex items-center justify-center relative']) }}>
Expand Down
83 changes: 52 additions & 31 deletions resources/views/components/data-type-option.blade.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,64 @@
<div>
<option value="">Select one</option>
<optgroup label="String fields">
<option value="lineString">Line String</option>
<option value="multiLineString">Multi Line String</option>
<option value="string">String</option>
<optgroup label="Common fields">
<option value="int">INT</option>
<option value="varchar">VARCHAR</option>
<option value="text">TEXT</option>
<option value="date">DATE</option>
</optgroup>

<optgroup label="Text fields">
<option value="mediumText">Medium text</option>
<option value="longText">Long text</option>
<option value="text">Text</option>
<option value="tinyText">Tiny text</option>
<optgroup label="Numeric">
<option value="tinyint">TINYINT</option>
<option value="smallint">SMALLINT</option>
<option value="mediumint">MEDIUMINT</option>
<option value="int">INT</option>
<option value="bigint">BIGINT</option>
<option value="decimal">DECIMAL</option>
<option value="float">FLOAT</option>
<option value="double">DOUBLE</option>
<option value="real">REAL</option>
<option value="bit">BIT</option>
<option value="boolean">BOOLEAN</option>
<option value="serial">SERIAL</option>
</optgroup>

<optgroup label="Integer fields">
<option value="bigInteger">Big Integer</option>
<option value="integer">Integer</option>
<option value="mediumInteger">Medium Integer</option>
<option value="smallInteger">Small Integer</option>
<option value="tinyInteger">Tiny Integer</option>
<optgroup label="Date and time">
<option value="date">DATE</option>
<option value="datetime">DATETIME</option>
<option value="timestamp">TIMESTAMP</option>
<option value="time">TIME</option>
<option value="year">YEAR</option>
</optgroup>

<optgroup label="Unsigned Integer fields">
<option value="unsignedBigInteger">Unsigned Big Integer</option>
<option value="unsignedInteger">Unsigned Integer</option>
<option value="unsignedMediumInteger">Unsigned Medium Integer</option>
<option value="unsignedSmallInteger">Unsigned Small Integer</option>
<option value="unsignedTinyInteger">Unsigned Tiny Integer</option>
<optgroup label="String">
<option value="char">CHAR</option>
<option value="varchar">VARCHAR</option>
<option value="tinytext">TINYTEXT</option>
<option value="text">TEXT</option>
<option value="mediumtext">MEDIUMTEXT</option>
<option value="longtext">LONGTEXT</option>
<option value="binary">BINARY</option>
<option value="varbinary">VARBINARY</option>
<option value="tinyblob">TINYBLOB</option>
<option value="blob">BLOB</option>
<option value="mediumblob">MEDIUMBLOB</option>
<option value="longblob">LONGBLOB</option>
<option value="enum">ENUM</option>
<option value="set">SET</option>
</optgroup>

<optgroup label="Other fields">
<option value="boolean">Boolean</option>
<option value="decimal">Decimal</option>
<option value="double">Double</option>
<option value="float">Float</option>
<option value="enum">Enum</option>
<option value="uuid">UUID</option>
<option value="date">Date</option>
<option value="foreignKey">Foreign Key</option>
<optgroup label="Spatial">
<option value="geometry">GEOMETRY</option>
<option value="point">POINT</option>
<option value="linestring">LINESTRING</option>
<option value="polygon">POLYGON</option>
<option value="multipoint">MULTIPOINT</option>
<option value="multilinestring">MULTILINESTRING</option>
<option value="multipolygon">MULTIPOLYGON</option>
<option value="geometrycollection">GEOMETRYCOLLECTION</option>
</optgroup>

<optgroup label="Other">
<option value="json">JSON</option>
</optgroup>

</div>
21 changes: 0 additions & 21 deletions resources/views/components/delete-field-modal.blade.php

This file was deleted.

21 changes: 21 additions & 0 deletions resources/views/components/delete-modal.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@props(['isDeleteModalOpen', 'deleteModalTitle', 'deleteModalMessage', 'deleteModalAction'])

<div wire:show="isDeleteModalOpen" x-data x-cloak x-transition.duration.200ms
x-on:click.self="$wire.isDeleteModalOpen = false"
class="fixed top-0 left-0 flex items-center justify-center w-full h-full bg-gray-500 bg-opacity-50 z-50">
<x-code-generator::modal modalTitle="{{ $deleteModalTitle }}">
<x-slot:closebtn>
<button x-on:click="$wire.isDeleteModalOpen = false"
class="text-gray-500 hover:text-black text-xl">&times;</button>
</x-slot:closebtn>
<div class="mt-4 space-y-4">
{{ $deleteModalMessage }}
</div>
<x-slot:footer>
<div class="mr-6">
<x-code-generator::button title="Cancel" x-on:click="$wire.$isDeleteModalOpen = false" />
</div>
<x-code-generator::button wire:click="{{ $deleteModalAction }}" title="Delete" />
</x-slot:footer>
</x-code-generator::modal>
</div>
21 changes: 0 additions & 21 deletions resources/views/components/delete-relation-modal.blade.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<td class="px-4 py-2 text-gray-600">{{$relation['intermediate_foreign_key'] ?? '-'}}</td>
<td class="px-4 py-2 text-gray-600">{{$relation['intermediate_local_key'] ?? '-'}}</td>
<td class="px-4 py-2 flex items-center">
<button wire:click="openDeleteModal('{{ $relation['id'] }}')" class="text-red-500">
<button wire:click="openDeleteRelationModal('{{ $relation['id'] }}')" class="text-red-500">
<x-code-generator::delete-svg />
</button>
<button wire:click="openEditRelationModal('{{ $relation['id'] }}')" class="text-red-500">
Expand Down
2 changes: 2 additions & 0 deletions resources/views/components/field-table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<th class="px-4 py-2 text-left text-sm">Column</th>
<th class="px-4 py-2 text-left text-sm">Data Type</th>
<th class="px-4 py-2 text-left text-sm">Validation</th>
<th class="px-4 py-2 text-left text-sm">Is in Fillable</th>
<th class="px-4 py-2 text-left text-sm">Is ForeignKey</th>
<th class="px-4 py-2 text-left text-sm">Related Model</th>
<th class="px-4 py-2 text-left text-sm">Referenced Column</th>
Expand All @@ -26,6 +27,7 @@
<td class="px-4 py-2">{{$field['column_name']}}</td>
<td class="px-4 py-2">{{$field['data_type']}}</td>
<td class="px-4 py-2">{{$field['column_validation']}}</td>
<td class="px-4 py-2">{{ !empty($field['is_fillable']) ? 'yes' : 'no' }}</td>
<td class="px-4 py-2">{{ !empty($field['is_foreign_key']) ? 'yes' : 'no' }}</td>
<td class="px-4 py-2">{{ !empty($field['foreign_model_name']) ? $field['foreign_model_name'] : '-' }}
</td>
Expand Down
34 changes: 24 additions & 10 deletions resources/views/components/notification-modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@props(['isEditing' => false])

<div wire:show="isNotificationModalOpen" x-data x-cloak x-transition.duration.200ms
class="fixed top-0 left-0 flex items-center justify-center w-full h-full bg-gray-500 bg-opacity-50 z-50"
x-on:click.self="$wire.isNotificationModalOpen=false">

<x-code-generator::modal modalTitle="Notification">
<x-code-generator::modal :modalTitle="$isEditing ? 'Update Notification' : 'Add Notification'">
<x-slot:closebtn>
<button x-on:click="$wire.isNotificationModalOpen=false"
class="text-gray-500 hover:text-black text-xl">&times;</button>
Expand All @@ -21,7 +23,7 @@ class="w-full mt-1 px-4 py-2 border border-gray-300 rounded-md focus:outline-non
<input wire:model.live="data" type="text" placeholder="Enter Data"
class="w-full mt-1 px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-400" />
@error('data') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
<p class="text-xs text-gray-400 mt-1">Example: user_id: 1</p>
<p class="text-xs text-gray-400 mt-1">Example: id,name</p>
</div>

<div>
Expand All @@ -30,20 +32,32 @@ class="w-full mt-1 px-4 py-2 border border-gray-300 rounded-md focus:outline-non
class="w-full mt-1 px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-400" />
@error('subject') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
</div>

<div>
<label class="block text-sm font-medium text-gray-700">Body</label>
<input wire:model.live="body" type="text" placeholder="Enter Text"
class="w-full mt-1 px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-400" />
@error('body') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
<div>
<label class="block text-sm font-medium text-gray-700 flex items-center gap-1">
Blade View Path
<div class="relative group cursor-pointer">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<title>Tooltip</title>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M12 2a10 10 0 100 20 10 10 0 000-20z" />
</svg>
<div class="absolute left-6 top-0 w-64 bg-gray-700 text-white text-sm rounded px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10">
Notification file will be added in <code>resources/views/</code> folder. If you will enter folder/blade file name then folder will be created first and then blade file will be created inside that folder.
</div>
</div>
</div>
</label>

<input wire:model.live="notification_blade_path" type="text" placeholder="users/email"
class="w-full mt-1 px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-400" />
@error('notification_blade_path')
<span class="text-red-600 text-sm">{{ $message }}</span>
@enderror
</div>
<x-slot:footer>
<div class="mr-6">
<x-code-generator::button title="Cancel" x-on:click="$wire.isNotificationModalOpen=false" />
</div>
<x-code-generator::button wire:click="saveNotification" title="Add" />
<x-code-generator::button wire:click="saveNotification" :title="$isEditing ? 'Update' : 'Add' " />
</x-slot:footer>
</x-code-generator::modal>
</div>
Loading