tastyigniter/core
Core code for TastyIgniter, a professional restaurant platform for online food ordering and table reservations. Powers the TastyIgniter application and extensions with a Laravel-based framework for building custom ordering systems.
Installation:
composer require tastyigniter/core
Ensure your composer.json specifies PHP 8.3–8.4 compatibility.
Publish Core Configurations:
php artisan vendor:publish --provider="TastyIgniter\Core\Providers\CoreServiceProvider"
This publishes:
config/admin.php)config/media.php)config/dashboard.php)First Use Case: Admin Panel Integration
Register a custom admin route in routes/admin.php:
Route::resource('custom-module', \TastyIgniter\Core\Http\Controllers\Admin\CustomModuleController::class);
Extend the base AdminController for CRUD operations:
use TastyIgniter\Core\Http\Controllers\Admin\AdminController;
class CustomModuleController extends AdminController
{
protected $model = \App\Models\CustomModule::class;
protected $view = 'admin.custom-modules.index';
}
Verify Extensions Check installed extensions via:
php artisan igniter:extensions
Update dependencies with:
php artisan igniter:update
TastyIgniter\Core\Foundation\Application (bootstrapping)TastyIgniter\Core\Http\Controllers\Admin\AdminController (base admin controller — now also owns the suppressNavigation layout flag)TastyIgniter\Core\Services\TemplateSandbox (sanitization logic, incl. SVG handling)config/admin.php, config/media.php (critical for customization).php artisan list | grep igniter # Lists core commands
Create a Custom Admin Module:
php artisan make:model CustomModule -m
AdminController (as shown above) and define views in resources/views/admin/custom-modules/./admin/custom-module.class CustomModuleController extends AdminController
{
protected $suppressNavigation = true;
}
Pattern: Extend AdminController for CRUD.
class PostsController extends AdminController
{
protected $model = \App\Models\Post::class;
protected $view = 'admin.posts.index';
protected $columns = ['title', 'published_at']; // Customize columns
}
Key Methods:
index(): Lists records (uses $columns).create()/edit(): Renders forms (uses makeForm()).store()/update(): Handles validation (uses validate()).Form Handling:
Use makeForm() to define fields:
protected function makeForm()
{
return [
'title' => 'text',
'content' => 'textarea',
'published_at' => 'datetime',
];
}
suppressNavigation, new in v4.4.5)class OnboardingWizardController extends AdminController
{
protected $suppressNavigation = true;
}
Pattern: Create a custom extension (e.g., for payments).
/extensions/PaymentGateway/
├── config/
├── resources/
├── src/
│ ├── Http/Controllers/
│ ├── Providers/
│ └── Services/
└── composer.json
config/extensions.php:
'payment-gateway' => [
'path' => base_path('extensions/PaymentGateway'),
'enabled' => true,
],
php artisan vendor:publish --tag=payment-gateway-assets
Key Classes:
ExtensionServiceProvider: Bootstraps extension logic.ExtensionController: Handles routes (e.g., /admin/payment-gateway).Pattern: Use TemplateSandbox for user-generated templates.
use TastyIgniter\Core\Services\TemplateSandbox;
$sandbox = new TemplateSandbox();
$sanitized = $sandbox->sanitize($userInputTemplate);
Common Use Cases:
resources/views/emails/custom.blade.php).Custom Rules:
Extend TemplateSandbox:
class CustomSandbox extends TemplateSandbox
{
protected function getAllowedTags()
{
return parent::getAllowedTags() + ['custom-tag'];
}
}
use TastyIgniter\Core\Traits\HasMedia;
class Post extends Model
{
use HasMedia;
}
$post = new Post();
$post->addMediaFromPath($path)->toMediaCollection('images');
$post->save();
config/media.php for storage (e.g., S3, local). SVG uploads are sanitized through enshrined/svg-sanitize, now on ^1.0.config/dashboard.php:
'widgets' => [
'custom' => [
'class' => \App\Widgets\CustomWidget::class,
'priority' => 10,
],
],
WidgetInterface:
class CustomWidget implements WidgetInterface
{
public function render()
{
return view('widgets.custom');
}
}
auth() helper or extend TastyIgniter\Core\Auth\AuthManager.extension.installed):
event(new ExtensionInstalled($extension));
media_attachments, languages, etc., as shown in v4.2.0.CacheMaker trait:
use TastyIgniter\Core\Traits\CacheMaker;
class MyService
{
use CacheMaker;
public function getCachedData($key)
{
return $this->cache->remember($key, now()->addHours(1), function () {
return $this->fetchData();
});
}
}
TastyIgniter\Core\Models\Language.trans() or extend the Language model:
$language = Language::find(2);
$translation = $language->translations()->where('key', 'welcome')->first();
/admin/logs (admin panel).FlashBag:
flash()->success('Action completed!')->withActionUrl('/admin/posts');
enshrined/svg-sanitize moved from ^0.22 to ^1.0 — a major version jump. Anything that pinned ^0.22, subclasses the sanitizer, or calls its API directly can break.
composer update enshrined/svg-sanitize in your app and in every extension that declares the constraint, then re-test SVG upload/preview paths:
composer update enshrined/svg-sanitize --with-dependencies
php artisan media:optimize # re-run thumbnails if previews look wrong
composer why enshrined/svg-sanitize to find which extension is holding back the old constraint.composer.json constraint conflicts are the most likely upgrade failure; a composer update that "does nothing" usually means an extension still requires ^0.22.TemplateSandbox may strip custom Blade directives.
getAllowedDirectives():
protected function getAllowedDirectives()
{
return ['customDirective'];
}
@verbatim for complex components:
@verbatim
{{!! $unsafeComponent !!}}
@endverbatim
suppressNavigation Behavioural Gotchascreate/edit follow-up screens where users need to get back.
public function index() { $this->suppressNavigation = true; return parent::index(); }
$this->suppressNavigation yourself.composer.json is missing.
extra.igniter config:
{
"extra": {
"igniter": {
"type": "extension",
"name": "payment-gateway"
}
}
}
igniter:update --check to validate dependencies.config/media.php paths and run:
php artisan storage:link
media:optimize to regenerate thumbnails:
php artisan media:optimize
Route::prefix('custom-modules')->group(function () {
Route::resource('/', CustomModuleController::class);
});
php artisan route:list | grep admin after adding routes, and clear caches (route:clear, view:clear) when a new controller 404s instead of rendering.--no-interaction or piped input) in igniter: commands.
--no-interaction rather than relying on the default prompt behaviour.How can I help you explore Laravel packages today?