-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bahman026/admin
Admin
- Loading branch information
Showing
3,846 changed files
with
181,039 additions
and
23,387 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
APP_NAME=ShopFlow | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_TIMEZONE=UTC | ||
APP_URL=http://localhost | ||
|
||
APP_LOCALE=en | ||
APP_FALLBACK_LOCALE=en | ||
APP_FAKER_LOCALE=en_US | ||
|
||
APP_MAINTENANCE_DRIVER=file | ||
# APP_MAINTENANCE_STORE=database | ||
|
||
BCRYPT_ROUNDS=12 | ||
|
||
LOG_CHANNEL=stack | ||
LOG_STACK=single | ||
LOG_DEPRECATIONS_CHANNEL=null | ||
LOG_LEVEL=debug | ||
|
||
DB_CONNECTION=pgsql | ||
DB_HOST=db | ||
DB_PORT= | ||
DB_DATABASE= | ||
DB_USERNAME= | ||
DB_PASSWORD= | ||
|
||
SESSION_DRIVER=database | ||
SESSION_LIFETIME=120 | ||
SESSION_ENCRYPT=false | ||
SESSION_PATH=/ | ||
SESSION_DOMAIN=null | ||
|
||
BROADCAST_CONNECTION=log | ||
FILESYSTEM_DISK=local | ||
QUEUE_CONNECTION=database | ||
|
||
CACHE_STORE=database | ||
CACHE_PREFIX= | ||
|
||
MEMCACHED_HOST=127.0.0.1 | ||
|
||
REDIS_CLIENT=phpredis | ||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=log | ||
MAIL_HOST=127.0.0.1 | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS="hello@example.com" | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
AWS_USE_PATH_STYLE_ENDPOINT=false | ||
|
||
VITE_APP_NAME="${APP_NAME}" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/.phpunit.cache | ||
/node_modules | ||
/public/build | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.env.production | ||
.phpactor.json | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
auth.json | ||
npm-debug.log | ||
yarn-error.log | ||
/.fleet | ||
/.idea | ||
/.vscode | ||
/app/Console/Commands/TestCommand.php |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Enums; | ||
|
||
use App\Traits\HasOptions; | ||
|
||
enum CategoryStatusEnum: int | ||
{ | ||
use HasOptions; | ||
|
||
case ACTIVE = 1; | ||
case INACTIVE = 2; | ||
|
||
public function label(): string | ||
{ | ||
return match ($this) { | ||
self::ACTIVE => 'Active', | ||
self::INACTIVE => 'Inactive', | ||
}; | ||
} | ||
|
||
public function color(): string | ||
{ | ||
return match ($this) { | ||
self::ACTIVE => 'success', | ||
self::INACTIVE => 'danger', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Enums; | ||
|
||
use App\Traits\HasOptions; | ||
|
||
enum PermissionsEnum: string | ||
{ | ||
use HasOptions; | ||
|
||
// Basic Permissions | ||
case VIEW_POSTS = 'view_posts'; | ||
case CREATE_POSTS = 'create_posts'; | ||
case EDIT_POSTS = 'edit_posts'; | ||
case DELETE_POSTS = 'delete_posts'; | ||
|
||
// User Management Permissions | ||
case VIEW_USERS = 'view_users'; | ||
case CREATE_USERS = 'create_users'; | ||
case EDIT_USERS = 'edit_users'; | ||
case DELETE_USERS = 'delete_users'; | ||
|
||
// Settings Permissions | ||
case VIEW_SETTINGS = 'view_settings'; | ||
case EDIT_SETTINGS = 'edit_settings'; | ||
|
||
public function label(): string | ||
{ | ||
return match ($this) { | ||
self::VIEW_POSTS => 'View Posts', | ||
self::CREATE_POSTS => 'Create Posts', | ||
self::EDIT_POSTS => 'Edit Posts', | ||
self::DELETE_POSTS => 'Delete Posts', | ||
self::VIEW_USERS => 'View Users', | ||
self::CREATE_USERS => 'Create Users', | ||
self::EDIT_USERS => 'Edit Users', | ||
self::DELETE_USERS => 'Delete Users', | ||
self::VIEW_SETTINGS => 'View Settings', | ||
self::EDIT_SETTINGS => 'Edit Settings', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Enums; | ||
|
||
use App\Traits\HasOptions; | ||
|
||
enum RolesEnum: string | ||
{ | ||
use HasOptions; | ||
|
||
case USER = 'user'; | ||
case ADMIN = 'admin'; | ||
case SUPER_ADMIN = 'super-admin'; | ||
|
||
public function label(): string | ||
{ | ||
return match ($this) { | ||
self::USER => 'User', | ||
self::ADMIN => 'Admin', | ||
self::SUPER_ADMIN => 'Super Admin', | ||
}; | ||
} | ||
|
||
public function color(): string | ||
{ | ||
return match ($this) { | ||
self::USER => 'info', | ||
self::ADMIN => 'success', | ||
self::SUPER_ADMIN => 'primary', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Enums; | ||
|
||
use App\Traits\HasOptions; | ||
|
||
enum UserStatusEnum: int | ||
{ | ||
use HasOptions; | ||
|
||
case ACTIVE = 1; | ||
case BLOCK = 2; | ||
|
||
public function label(): string | ||
{ | ||
return match ($this) { | ||
self::ACTIVE => 'Active', | ||
self::BLOCK => 'Block', | ||
}; | ||
} | ||
|
||
public function color(): string | ||
{ | ||
return match ($this) { | ||
self::ACTIVE => 'success', | ||
self::BLOCK => 'danger', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Enums\CategoryStatusEnum; | ||
use App\Filament\Resources\CategoryResource\Pages; | ||
use App\Models\Category; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
use FilamentTiptapEditor\Enums\TiptapOutput; | ||
use FilamentTiptapEditor\TiptapEditor; | ||
|
||
class CategoryResource extends Resource | ||
{ | ||
protected static ?string $model = Category::class; | ||
|
||
protected static ?string $navigationGroup = 'Product'; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('heading') | ||
->required(), | ||
Forms\Components\TextInput::make('slug') | ||
->required(), | ||
Forms\Components\TextInput::make('title'), | ||
TiptapEditor::make('content') | ||
->output(TiptapOutput::Html) // optional, change the format for saved data, default is html | ||
->columnSpanFull() | ||
->extraInputAttributes(['style' => 'min-height: 12rem;']) | ||
->required(), | ||
Forms\Components\Textarea::make('description') | ||
->maxLength(255) | ||
->columnSpanFull(), | ||
Forms\Components\TextInput::make('canonical'), | ||
Forms\Components\Select::make('parent_id') | ||
->options(function () { | ||
return Category::active() | ||
->get() | ||
->pluck('heading', 'id'); | ||
}), | ||
Forms\Components\Toggle::make('no_index'), | ||
|
||
Forms\Components\Repeater::make('images') | ||
->relationship() | ||
->maxItems(1) | ||
->schema([ | ||
Forms\Components\FileUpload::make('path') | ||
->previewable(), | ||
]) | ||
->columns(1) | ||
->columnSpanFull(), | ||
Forms\Components\Select::make('status') | ||
->options(CategoryStatusEnum::options()), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('heading') | ||
->limit(30) | ||
->wrap(), | ||
Tables\Columns\TextColumn::make('description') | ||
->limit(30) | ||
->wrap() | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('content') | ||
->limit(60) | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('status') | ||
->getStateUsing(fn (Category $record): string => CategoryStatusEnum::from((int) $record->status)->label()) | ||
->color(fn (Category $record): string => CategoryStatusEnum::from((int) $record->status)->color()) | ||
->sortable(), | ||
Tables\Columns\IconColumn::make('no_index') | ||
->boolean(), | ||
Tables\Columns\TextColumn::make('parent_id') | ||
->getStateUsing(function (Category $record) { | ||
if ($record->parent_id) { | ||
return "($record->parent_id) $record->title"; | ||
} | ||
|
||
return null; | ||
}) | ||
->limit(20) | ||
->wrap() | ||
->numeric() | ||
->sortable(), | ||
Tables\Columns\ImageColumn::make('images') | ||
->getStateUsing(function (Category $record) { | ||
return $record->images->first()?->path; | ||
}), | ||
|
||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
Tables\Columns\TextColumn::make('updated_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
Tables\Actions\EditAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
// | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListCategories::route('/'), | ||
'create' => Pages\CreateCategory::route('/create'), | ||
'edit' => Pages\EditCategory::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
ShopFlow/app/Filament/Resources/CategoryResource/Pages/CreateCategory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\CategoryResource\Pages; | ||
|
||
use App\Filament\Resources\CategoryResource; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateCategory extends CreateRecord | ||
{ | ||
protected static string $resource = CategoryResource::class; | ||
} |
Oops, something went wrong.