### Install Tyro Dashboard Source: https://hasinhayder.github.io/tyro-dashboard/index.html Install the Tyro Dashboard package using Composer. ```bash composer require hasinhayder/tyro-dashboard ``` -------------------------------- ### Run Tyro Dashboard Installer Source: https://hasinhayder.github.io/tyro-dashboard/index.html Execute this Artisan command to scaffold your views, publish assets, and create your initial super-admin credentials. ```bash php artisan tyro-dashboard:install ``` -------------------------------- ### Example Activity Log Entry Source: https://hasinhayder.github.io/tyro-dashboard/index.html This snippet shows an example of an immutable record saved to the Black Box, detailing changes to a User model. ```text [18:14:02] App\Models\User#11 updated Actor: Admin User (#1) - email: "johny@example.com" + email: "jonny@example.com" - role_id: 2 (Editor) + role_id: 1 (Admin) // Immutable record saved to Black Box. ``` -------------------------------- ### Modal Dialog Usage Examples Source: https://hasinhayder.github.io/tyro-dashboard/doc.html Examples demonstrating the usage of showConfirm, showDanger, and showAlert functions for modal dialogs in Tyro Dashboard. ```javascript // Basic confirmation before form submit showConfirm('Delete Record', 'Are you sure you want to delete this item?', function() { document.getElementById('delete-form').submit(); }); // Danger dialog for destructive actions showDanger('Suspend User', 'This will revoke all access for this user.', function() { window.location.href = '/dashboard/users/42/suspend'; }); // Simple alert showAlert('Success', 'The record has been saved successfully.'); ``` -------------------------------- ### Text Field Configuration Example Source: https://hasinhayder.github.io/tyro-dashboard/doc.html Configure a standard text input with various options including label, validation rules, default value, placeholder, help text, and visibility settings. ```php 'description' => [ 'type' => 'text', 'label' => 'Display Label', 'rules' => 'required|min:5|max:200', 'default' => 'Initial Text', 'placeholder' => 'Enter text here', 'help_text' => 'Optional string beneath the input describing usage', 'hide_in_index' => true, 'hide_in_create' => true, 'hide_in_edit' => true, 'hide_in_form' => true, 'hide_in_single_view' => true, 'readonly' => true, ] ``` -------------------------------- ### Set Sidebar Colors and Options Source: https://hasinhayder.github.io/tyro-dashboard/doc.html Configure sidebar background color, text color, and whether to disable example menu items using environment variables. ```dotenv TYRO_DASHBOARD_SIDEBAR_BG=#1e293b TYRO_DASHBOARD_SIDEBAR_TEXT=#f8fafc TYRO_DASHBOARD_DISABLE_EXAMPLES=true ``` -------------------------------- ### Basic Model with HasCrud Trait Source: https://hasinhayder.github.io/tyro-dashboard/doc.html This example shows a basic Eloquent model configured with the HasCrud trait. It includes fillable properties and defines a relationship that HasCrud will use to generate a select field. ```php namespace App\Models; use Illuminate\Database\Eloquent\Model; use HasinHayder\TyroDashboard\Concerns\HasCrud; class Post extends Model { use HasCrud; protected $fillable = [ 'title', 'content', 'is_published', 'category_id', ]; // Defining this relationship tells HasCrud to automatically create a select field for category_id! public function category() { return $this->belongsTo(Category::class); } } ``` -------------------------------- ### Manual Theme Editing Example Source: https://hasinhayder.github.io/tyro-dashboard/doc.html Modify the CSS variables in the shadcn-theme.blade.php file to customize the theme. This file contains only CSS variables for safe editing. ```html