Installation:
composer require tastyigniter/ti-theme-orange
Publish the theme assets and configuration:
php artisan vendor:publish --provider="TastyIgniter\Orange\OrangeServiceProvider" --tag="orange-assets"
php artisan vendor:publish --provider="TastyIgniter\Orange\OrangeServiceProvider" --tag="orange-config"
Theme Activation:
Update your config/app.php to include the Orange theme in the providers array:
TastyIgniter\Orange\OrangeServiceProvider::class,
Set the default theme in config/orange.php:
'default' => 'orange',
First Use Case:
Replace your existing resources/views/layouts/app.blade.php with the Orange theme’s layout:
@extends('igniter.orange::layouts.app')
Override specific views by copying them from vendor/tastyigniter/ti-theme-orange/resources/views to your resources/views/igniter/orange directory.
vendor/tastyigniter/ti-theme-orange/resources/views to understand the structure and components.vendor/tastyigniter/ti-theme-orange/resources/js for interactive elements like CartBox, Checkout, and Booking.config/orange.php for theme-specific settings like checkout flows, menu options, and SEO configurations.Customize the Header:
vendor/tastyigniter/ti-theme-orange/resources/views/partials/header.blade.php to resources/views/igniter/orange/partials/header.blade.php.LocalHeader Livewire component (located in vendor/tastyigniter/ti-theme-orange/app/Http/Livewire) to add custom logic, such as dynamic opening hours or promotions.resources/views/igniter/orange directory. For example:
// Override the menu layout
resources/views/igniter/orange/layouts/menu.blade.php
resources/sass/orange/app.scss file (published during installation). Use variables defined in _variables.scss for consistent theming.CartBox, Checkout) by creating a new class in app/Http/Livewire that extends the original:
namespace App\Http\Livewire;
use TastyIgniter\Orange\Http\Livewire\CartBox as OriginalCartBox;
class CartBox extends OriginalCartBox
{
public function render()
{
// Custom logic
return view('igniter.orange::livewire.cart-box')->layout('layouts.app');
}
}
@livewire directive:
@livewire('cart-box', ['orderType' => $orderType])
config/orange.php:
'checkout' => [
'flow' => 'two_page', // or 'single_page'
],
PaymentMethod model or override the Checkout Livewire component to add custom payment gateways.CategoryList and ListMenuItems components to display menus dynamically:
@livewire('category-list', ['locationId' => $locationId])
@livewire('list-menu-items', ['categoryId' => $categoryId])
hide_unavailable_items option in config/orange.php:
'menu' => [
'hide_unavailable_items' => true,
],
use Spatie\SeoManager\SeoManager;
SeoManager::set('menu.show', [
'title' => 'Our Menu',
'description' => 'Explore our delicious menu options.',
]);
webpack.mix.js file for compiling SASS and JavaScript. Extend it in your webpack.mix.js:
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/orange/app.scss', 'public/css');
LocationData class to fetch location-specific data (e.g., reviews, opening hours):
use TastyIgniter\Orange\Data\LocationData;
$locationData = new LocationData($locationId);
$reviews = $locationData->reviews;
routes/web.php:
Route::prefix('api/orange')->group(function () {
Route::get('/menu', [\App\Http\Controllers\Orange\MenuController::class, 'index']);
});
use Livewire\Livewire;
public function test_cart_box()
{
Livewire::test('cart-box')
->assertSee('Your Cart')
->call('addToCart', $menuItem)
->assertSee('Added to Cart');
}
url() helper (fixed in v4.1.5).{{ url()->current() }} or {{ route('...') }} instead of relative paths.php artisan view:clear
php artisan cache:clear
$coordinates = (float) $location->latitude;
Checkout Livewire component updates the payment_method property correctly:
public $paymentMethod;
public function updatedPaymentMethod()
{
$this->validate(['paymentMethod' => 'required']);
}
@teleport (added in v4.0.8).@livewire('mobile-cart-button')
igniter.orange::default.newsletter instead of igniter.frontend::default.newsletter.Route::get('/admin/theme-editor', [\TastyIgniter\Orange\Http\Controllers\ThemeEditorController::class, 'index']);
StaticPage model. Use the StaticPageController to display them:
@livewire('static-page', ['slug' => 'about'])
How can I help you explore Laravel packages today?