diff --git a/README.md b/README.md index 1d8b98a..4fcb95c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![tests](https://github.com/usetrmnl/byos_laravel/actions/workflows/test.yml/badge.svg)](https://github.com/usetrmnl/byos_laravel/actions/workflows/test.yml) TRMNL BYOS Laravel is a self-hostable implementation of a TRMNL server, built with Laravel. -It enables you to manage TRMNL devices, generate screens dynamically, and can act as a proxy for the native cloud service (native plugins, receipts). +It enables you to manage TRMNL devices, generate screens dynamically, and can act as a proxy for the native cloud service (native plugins, recipes). Inspired by [usetrmnl/byos_sinatra](https://github.com/usetrmnl/byos_sinatra). If you are looking for a Laravel package designed to streamline the development of both public and private TRMNL plugins, check out [bnussbau/trmnl-laravel](https://github.com/bnussbau/laravel-trmnl). @@ -116,10 +116,10 @@ Login with user / password `admin@example.com` / `admin@example.com` ### Demo Plugins -Run the ExampleReceiptsSeeder to seed the database with example plugins: +Run the ExampleRecipesSeeder to seed the database with example plugins: ```bash -php artisan db:seed --class=ExampleReceiptsSeeder +php artisan db:seed --class=ExampleRecipesSeeder ``` * Zen Quotes diff --git a/app/Console/Commands/ExampleReceiptsSeederCommand.php b/app/Console/Commands/ExampleReceiptsSeederCommand.php deleted file mode 100644 index f94ff8a..0000000 --- a/app/Console/Commands/ExampleReceiptsSeederCommand.php +++ /dev/null @@ -1,20 +0,0 @@ -argument('user_id'); - $seeder->run($user_id); - } -} diff --git a/app/Console/Commands/ExampleRecipesSeederCommand.php b/app/Console/Commands/ExampleRecipesSeederCommand.php new file mode 100644 index 0000000..9146276 --- /dev/null +++ b/app/Console/Commands/ExampleRecipesSeederCommand.php @@ -0,0 +1,20 @@ +argument('user_id'); + $seeder->run($user_id); + } +} diff --git a/database/migrations/2025_04_26_120013_update_plugin_table_correct_recipe_typo.php b/database/migrations/2025_04_26_120013_update_plugin_table_correct_recipe_typo.php new file mode 100644 index 0000000..d6efa6a --- /dev/null +++ b/database/migrations/2025_04_26_120013_update_plugin_table_correct_recipe_typo.php @@ -0,0 +1,47 @@ +where('uuid', $uuid) + ->update([ + 'render_markup_view' => DB::raw("REPLACE(render_markup_view, 'receipts.', 'recipes.')"), + ]); + } + } + + public function down(): void + { + // Revert the typo correction if needed + $pluginUuids = [ + '9e46c6cf-358c-4bfe-8998-436b3a207fec', // ÖBB Departures + '3b046eda-34e9-4232-b935-c33b989a284b', // Weather + '21464b16-5f5a-4099-a967-f5c915e3da54', // Zen Quotes + '8d472959-400f-46ee-afb2-4a9f1cfd521f', // This Day in History + '4349fdad-a273-450b-aa00-3d32f2de788d', // Home Assistant + ]; + + foreach ($pluginUuids as $uuid) { + DB::table('plugins') + ->where('uuid', $uuid) + ->update([ + 'render_markup_view' => DB::raw("REPLACE(render_markup_view, 'recipes.', 'receipts.')"), + ]); + } + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index e6ca498..66b5d5f 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -33,7 +33,7 @@ class DatabaseSeeder extends Seeder // Plugin::factory(3)->create(); $this->call([ - ExampleReceiptsSeeder::class, + ExampleRecipesSeeder::class, ]); } } diff --git a/database/seeders/ExampleReceiptsSeeder.php b/database/seeders/ExampleRecipesSeeder.php similarity index 91% rename from database/seeders/ExampleReceiptsSeeder.php rename to database/seeders/ExampleRecipesSeeder.php index 6b64397..50dc77b 100644 --- a/database/seeders/ExampleReceiptsSeeder.php +++ b/database/seeders/ExampleRecipesSeeder.php @@ -5,7 +5,7 @@ namespace Database\Seeders; use App\Models\Plugin; use Illuminate\Database\Seeder; -class ExampleReceiptsSeeder extends Seeder +class ExampleRecipesSeeder extends Seeder { /** * Run the database seeds. @@ -24,7 +24,7 @@ class ExampleReceiptsSeeder extends Seeder 'polling_verb' => 'get', 'polling_header' => null, 'render_markup' => null, - 'render_markup_view' => 'receipts.train', + 'render_markup_view' => 'recipes.train', 'detail_view_route' => null, 'icon_url' => null, 'flux_icon_name' => 'train-front', @@ -43,7 +43,7 @@ class ExampleReceiptsSeeder extends Seeder 'polling_verb' => 'get', 'polling_header' => null, 'render_markup' => null, - 'render_markup_view' => 'receipts.weather', + 'render_markup_view' => 'recipes.weather', 'detail_view_route' => null, 'icon_url' => null, 'flux_icon_name' => 'sun', @@ -62,7 +62,7 @@ class ExampleReceiptsSeeder extends Seeder 'polling_verb' => 'get', 'polling_header' => null, 'render_markup' => null, - 'render_markup_view' => 'receipts.zen', + 'render_markup_view' => 'recipes.zen', 'detail_view_route' => null, 'icon_url' => null, 'flux_icon_name' => 'chat-bubble-bottom-center', @@ -81,7 +81,7 @@ class ExampleReceiptsSeeder extends Seeder 'polling_verb' => 'get', 'polling_header' => null, 'render_markup' => null, - 'render_markup_view' => 'receipts.day-in-history', + 'render_markup_view' => 'recipes.day-in-history', 'detail_view_route' => null, 'icon_url' => null, 'flux_icon_name' => 'calendar', @@ -100,7 +100,7 @@ class ExampleReceiptsSeeder extends Seeder 'polling_verb' => 'get', 'polling_header' => 'Authorization: Bearer YOUR_API_KEY', 'render_markup' => null, - 'render_markup_view' => 'receipts.home-assistant', + 'render_markup_view' => 'recipes.home-assistant', 'detail_view_route' => null, 'icon_url' => null, 'flux_icon_name' => 'thermometer', diff --git a/resources/views/components/layouts/app/header.blade.php b/resources/views/components/layouts/app/header.blade.php index b5639bf..6f405e3 100644 --- a/resources/views/components/layouts/app/header.blade.php +++ b/resources/views/components/layouts/app/header.blade.php @@ -21,8 +21,8 @@ Devices - Plugins & Receipts + :current="request()->routeIs(['plugins.index', 'plugins.markup', 'plugins.api', 'plugins.recipe'])"> + Plugins & Recipes @@ -102,7 +102,7 @@ - Plugins & Receipts + Plugins & Recipes diff --git a/resources/views/livewire/playlists/index.blade.php b/resources/views/livewire/playlists/index.blade.php index 24b780f..d57757c 100644 --- a/resources/views/livewire/playlists/index.blade.php +++ b/resources/views/livewire/playlists/index.blade.php @@ -179,7 +179,7 @@ new class extends Component { -
Plugin / Receipt
+
Plugin / Recipe
diff --git a/resources/views/livewire/plugins/index.blade.php b/resources/views/livewire/plugins/index.blade.php index 062c77f..4de3671 100644 --- a/resources/views/livewire/plugins/index.blade.php +++ b/resources/views/livewire/plugins/index.blade.php @@ -60,8 +60,8 @@ new class extends Component { public function seedExamplePlugins(): void { -// \Artisan::call('db:seed', ['--class' => 'ExampleReceiptsSeeder']); - \Artisan::call(\App\Console\Commands\ExampleReceiptsSeederCommand::class, ['user_id' => auth()->id()]); +// \Artisan::call('db:seed', ['--class' => 'ExampleRecipesSeeder']); + \Artisan::call(\App\Console\Commands\ExampleRecipesSeederCommand::class, ['user_id' => auth()->id()]); } @@ -71,20 +71,20 @@ new class extends Component {
-

Plugins & Receipts

+

Plugins & Recipes

- Add Receipt + Add Recipe - Seed Example Receipts + Seed Example Recipes {{-- --}} - {{-- --}} - {{-- Import Receipt ZIP File--}} + {{-- --}} + {{-- Import Recipe ZIP File--}} {{-- --}} {{-- --}} {{-- --}} @@ -100,7 +100,7 @@ new class extends Component {
- Add Receipt + Add Recipe
@@ -142,7 +142,7 @@ new class extends Component {
- Create Receipt + Create Recipe
@@ -152,7 +152,7 @@ new class extends Component { @foreach($plugins as $plugin)
-

{{$plugin->name}} - Receipt + Recipe

diff --git a/resources/views/receipts/day-in-history.liquid b/resources/views/recipes/day-in-history.liquid similarity index 100% rename from resources/views/receipts/day-in-history.liquid rename to resources/views/recipes/day-in-history.liquid diff --git a/resources/views/receipts/home-assistant.blade.php b/resources/views/recipes/home-assistant.blade.php similarity index 100% rename from resources/views/receipts/home-assistant.blade.php rename to resources/views/recipes/home-assistant.blade.php diff --git a/resources/views/receipts/train-monitor.blade.php b/resources/views/recipes/train-monitor.blade.php similarity index 100% rename from resources/views/receipts/train-monitor.blade.php rename to resources/views/recipes/train-monitor.blade.php diff --git a/resources/views/receipts/train.blade.php b/resources/views/recipes/train.blade.php similarity index 100% rename from resources/views/receipts/train.blade.php rename to resources/views/recipes/train.blade.php diff --git a/resources/views/receipts/weather.blade.php b/resources/views/recipes/weather.blade.php similarity index 100% rename from resources/views/receipts/weather.blade.php rename to resources/views/recipes/weather.blade.php diff --git a/resources/views/receipts/zen.blade.php b/resources/views/recipes/zen.blade.php similarity index 100% rename from resources/views/receipts/zen.blade.php rename to resources/views/recipes/zen.blade.php diff --git a/routes/web.php b/routes/web.php index 613945e..65d9912 100644 --- a/routes/web.php +++ b/routes/web.php @@ -20,7 +20,7 @@ Route::middleware(['auth'])->group(function () { Volt::route('plugins', 'plugins.index')->name('plugins.index'); - Volt::route('plugins/receipt/{plugin}', 'plugins.receipt')->name('plugins.receipt'); + Volt::route('plugins/recipe/{plugin}', 'plugins.recipe')->name('plugins.recipe'); Volt::route('plugins/markup', 'plugins.markup')->name('plugins.markup'); Volt::route('plugins/api', 'plugins.api')->name('plugins.api'); Volt::route('playlists', 'playlists.index')->name('playlists.index');