### Create a New Hypervel Project Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/installation.md Creates a new Hypervel project using Composer's create-project command. This command downloads the Hypervel skeleton and installs its dependencies, setting up a new application instance named 'example-app'. ```shell composer create-project hypervel/hypervel example-app ``` -------------------------------- ### Basic PHPUnit Test Example in Hypervel Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/testing.md A fundamental example of a PHPUnit test case within a Hypervel application. This demonstrates a simple assertion to verify basic test execution. ```php assertTrue(true); } } ``` -------------------------------- ### Start Hypervel Development Server Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/installation.md Starts Hypervel's local development server and enables hot reloading for development. The `serve` command launches the HTTP server, making the application accessible at http://localhost:9501. The `watch` command automatically restarts the server on file changes. ```shell cd example-app php artisan serve ``` ```shell php artisan watch ``` -------------------------------- ### Run Hypervel Docker Container Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/installation.md This command starts a Hypervel Docker container, mapping the host's local directory to the container's project directory and exposing the necessary port. It also includes options for privileged access and root user, which are recommended when SELinux is enabled on the host. ```shell docker run --name hypervel \ -v /workspace/hypervel:/data/project \ -p 9501:9501 -it \ --privileged -u root \ --entrypoint /bin/sh \ hyperf/hyperf:8.3-alpine-v3.19-swoole-v6 ``` -------------------------------- ### Define Basic GET Route - PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/routing.md Defines a simple GET route that returns a 'Hello World' string when accessed at the '/greeting' URI. This utilizes Hypervel's facade for route definition. No external dependencies are explicitly required for this basic example. ```php use Hypervel\Support\Facades\Route; Route::get('/greeting', function () { return 'Hello World'; }); ``` -------------------------------- ### PHP Configuration Access Example Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/packages.md Demonstrates how to access a published configuration value in PHP after it has been made available by a service provider. The `config()` helper function is used to retrieve the value of 'option' from the 'courier' configuration file. ```php // Assuming 'courier.php' has been published and contains an 'option' key. $value = config('courier.option'); ``` -------------------------------- ### PHPDoc with Mixed Type Hinting Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/contributions.md This code example shows the correct PHPDoc format for documenting a parameter that can accept mixed types or an array. It illustrates the required spacing and attribute usage for Hypervel's documentation standards. ```php /** * E-mail the results of the scheduled operation if it fails. * * @param array|mixed $addresses */ public function emailOutputOnFailure(mixed $addresses): static ``` -------------------------------- ### Invoke Setup and Tear Down in Coroutines - PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/testing.md This example demonstrates how to explicitly invoke setup and tear down routines within coroutine tests using Hypervel.org. By overriding `invokeSetupInCoroutine` and `invokeTearDownInCoroutine`, developers can ensure that context is correctly managed and shared between their test functions and these setup/teardown methods. ```php use PHPUnit\Framework\TestCase; use Hypervel\Foundation\Testing\Concerns\RunTestsInCoroutine; class UnitTest extends TestCase { use RunTestsInCoroutine; protected function invokeSetupInCoroutine(): void { Context::set('auth_context.users.foo'); } protected function invokeTearDownInCoroutine(): void { // ... } public function testCoroutines(): void { dump(Context::get('auth_context.users.foo')); } } ``` -------------------------------- ### Setting up Database Queue Driver - Hypervel Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/queues.md Provides Artisan commands to generate the necessary migration for the database queue table and apply it to the database. Also shows how to configure the application to use the database driver. ```bash php artisan queue:table php artisan migrate ``` ```dotenv QUEUE_CONNECTION=database ``` -------------------------------- ### FTP Driver Configuration Example Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/filesystem.md Provides a sample configuration array for the FTP storage driver. This includes essential connection details like host, username, and password, along with optional settings for port, root directory, passive mode, SSL, and timeouts. This configuration should be placed in your `config/filesystems.php` file. ```php 'ftp' => [ 'driver' => 'ftp', 'host' => env('FTP_HOST'), 'username' => env('FTP_USERNAME'), 'password' => env('FTP_PASSWORD'), // Optional FTP Settings... // 'port' => env('FTP_PORT', 21), // 'root' => env('FTP_ROOT'), // 'passive' => true, // 'ssl' => true, // 'timeout' => 30, ], ``` -------------------------------- ### Manage Context with setUp and tearDown in Coroutine Tests - PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/testing.md This example shows how to use PHPUnit's setUp and tearDown methods to manage context for coroutine tests. It highlights setting context before a test and destroying it afterwards, ensuring proper cleanup. Note that setUp and tearDown might not execute within coroutines by default, but Hypervel's testing traits can manage this. ```php use PHPUnit\Framework\TestCase; use Hypervel\Context\Context; use Hypervel\Foundation\Testing\Concerns\RunTestsInCoroutine; class UnitTest extends TestCase { use RunTestsInCoroutine; public function setUp(): void { Context::set('auth_context.users.foo'); } public function testCoroutines(): void { dump(Context::get('auth_context.users.foo')); } public function tearDown(): void { Context::destroy('auth_context.users.foo'); } } ``` -------------------------------- ### Configure Package Discovery for Hypervel Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/packages.md This JSON snippet demonstrates how to configure your package for automatic discovery by Hypervel. It specifies the service providers and facade aliases to be registered. This enhances the user experience by automating the setup process. ```json { "extra": { "hypervel": { "providers": [ "Barryvdh\\Debugbar\\ServiceProvider" ], "aliases": { "Debugbar": "Barryvdh\\Debugbar\\Facade" } } } } ``` -------------------------------- ### HTTP Client - Practical Example: GitHub API Integration Source: https://context7.com/hypervel/hypervel.org/llms.txt A real-world example demonstrating how to use the HTTP client to fetch repository data from the GitHub API. ```APIDOC ## HTTP Client - Practical Example: GitHub API Integration ### Description This example illustrates a practical application of the Hypervel HTTP client within a service class to interact with an external API, specifically fetching user repositories from GitHub. ### Method GET ### Endpoint `https://api.github.com/users/{username}/repos` ### Parameters #### Path Parameters - **username** (string) - Required - The GitHub username whose repositories are to be fetched. #### Request Body None ### Request Example ```php class GithubService { public function getUserRepos(string $username): array { $response = Http::withHeaders([ 'Accept' => 'application/vnd.github.v3+json', ])->timeout(10) ->get("https://api.github.com/users/{$username}/repos"); if ($response->successful()) { return $response->json(); } throw new \Exception('Failed to fetch repositories'); } } ``` ### Response #### Success Response (200) - **repositories** (array) - An array of repository objects for the specified user. #### Response Example ```json [ { "id": 123456789, "name": "my-repo", "full_name": "username/my-repo", "description": "A sample repository." } ] ``` #### Error Response (e.g., 404) - Throws an `Exception` if the request is not successful. ``` -------------------------------- ### Eloquent Observer Example in PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md An example of an Eloquent observer class with methods corresponding to model events like 'created', 'updated', 'deleted', etc. Each method receives the affected model as an argument. Requires PHP and Eloquent model definitions. ```php 'local', 'root' => '/path/to/root', ]); $disk->put('image.jpg', $content); ``` -------------------------------- ### Register Eloquent Observer in AppServiceProvider Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Register an observer for a model by calling the `observe` method on the model within the `boot` method of `AppServiceProvider`. This links the observer class to the model's events. Requires PHP and Eloquent setup. ```php use App\Models\User; use App\Observers\UserObserver; /** * Bootstrap any application services. */ public function boot(): void { User::observe(UserObserver::class); } ``` -------------------------------- ### PHP: Add Placeholder and Hint to Search Prompt Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/prompts.md This code example shows how to enhance the 'search' prompt by adding placeholder text and an informational hint. The 'placeholder' argument provides example input, while the 'hint' argument offers additional context to the user. Dependencies include the 'search' function and potentially a User model. ```php $id = search( label: 'Search for the user that should receive the mail', placeholder: 'E.g. Taylor Otwell', options: fn (string $value) => strlen($value) > 0 ? User::whereLike('name', "%{$value}%")->pluck('name', 'id')->all() : [], hint: 'The user will receive an email immediately.' ); ``` -------------------------------- ### Hash Password Example Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/hashing.md Demonstrates how to securely hash a user's password using the Hash facade's 'make' method. This is a fundamental operation for storing sensitive user credentials. ```php user()->fill([ 'password' => Hash::make($request->newPassword) ])->save(); return redirect('/profile'); } } ``` -------------------------------- ### Customize Timestamp Column Names in Eloquent Models Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md This example demonstrates how to change the names of the columns used for Eloquent timestamps. By defining the `CREATED_AT` and `UPDATED_AT` constants within the model, you can specify custom names like `creation_date` and `updated_date`. ```php 'Traveling to Europe']); $article->id; // "8f8e8478-9035-4d23-b9a7-62f4d2612ce5" ``` -------------------------------- ### S3 Driver Pool Configuration Example Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/filesystem.md Shows an example of configuring object pool settings for the 's3' driver. This allows control over connection pooling, including minimum and maximum objects, wait timeouts, and maximum object lifetime. Proper configuration is crucial for concurrent requests. ```php 's3' => [ 'driver' => 's3', // ... 'pool' => [ 'min_objects' => 1, 'max_objects' => 10, 'wait_timeout' => 3.0, 'max_lifetime' => 60.0, ], ], ``` -------------------------------- ### Install Dropbox Flysystem Adapter (Shell) Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/filesystem.md Installs the Spatie Dropbox Flysystem adapter using Composer. This is a prerequisite for using Dropbox as a custom filesystem. ```shell composer require spatie/flysystem-dropbox ``` -------------------------------- ### Dispatch Batch of Jobs with Callbacks using Hypervel\Support\Facades\Bus Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/queues.md This example shows how to dispatch a batch of jobs using the `Bus` facade. It includes defining various completion callbacks like `before`, `progress`, `then`, `catch`, and `finally`. These callbacks receive a `Batch` instance and allow for custom actions upon batch creation, job completion, failure, or finalization. The batch ID is returned for later inspection. ```php use App\Jobs\ImportCsv; use Hypervel\Bus\Batch; use Hypervel\Support\Facades\Bus; use Throwable; $batch = Bus::batch([ new ImportCsv(1, 100), new ImportCsv(101, 200), new ImportCsv(201, 300), new ImportCsv(301, 400), new ImportCsv(401, 500), ])->before(function (Batch $batch) { // The batch has been created but no jobs have been added... })->progress(function (Batch $batch) { // A single job has completed successfully... })->then(function (Batch $batch) { // All jobs completed successfully... })->catch(function (Batch $batch, Throwable $e) { // First batch job failure detected... })->finally(function (Batch $batch) { // The batch has finished executing... })->dispatch(); return $batch->id; ``` -------------------------------- ### Implement Custom Global Scope (PHP) Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Defines a custom global scope by implementing the `Scope` interface and its `apply` method. The `apply` method receives the query builder and model instance, allowing you to add constraints like `where` clauses to all queries for that model. This example adds a constraint for records created more than 2000 years ago. ```php where('created_at', '<', now()->subYears(2000)); } } ``` -------------------------------- ### Eloquent Model Conventions: Primary Key Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md This example shows how Eloquent assumes a default primary key named 'id' and how to specify a different primary key column using the `$primaryKey` property. It also covers the assumption that the primary key is an auto-incrementing integer and how to disable this with `$incrementing` and specify a different key type with `$keyType`. ```php 'application/vnd.github.v3+json', ])->timeout(10) ->get("https://api.github.com/users/{$username}/repos"); if ($response->successful()) { return $response->json(); } throw new \Exception('Failed to fetch repositories'); } } ``` -------------------------------- ### Apply Prefix Option to Routes and Groups Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/routing.md This example shows how to apply a prefix to individual routes or entire route groups using the `prefix` option. This allows for flexible URI structuring. ```php Route::get('users', function () { // Matches The "/api/users" URL }, ['prefix' => 'api']); ``` ```php Route::group('/admin', function () { Route::get('/users', function () { // Matches The "/api/admin/users" URL }); }, ['prefix' => 'api']); ``` -------------------------------- ### Build Custom Queries with Eloquent Model Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Eloquent models act as query builders. You can chain query builder methods like `where`, `orderBy`, and `take` before calling `get` to retrieve filtered and sorted results. ```php $flights = Flight::where('active', 1) ->orderBy('name') ->take(10) ->get(); ``` -------------------------------- ### Configure Testbench with testbench.yaml Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/testbench.md Example of a basic testbench.yaml configuration file. It specifies the package's service provider and lists packages to be excluded from discovery. ```yaml providers: - Hypervel\Package\PackageServiceProvider dont-discover: - hypervel/sanctum ``` -------------------------------- ### PHP Configuration Example with Environment Variable Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/configuration.md This PHP code snippet demonstrates an unsupported recursive configuration resolution. Referencing `config('bar.title')` within a config file that is loaded early will result in an error because the Config Instance is not yet ready. ```php return [ 'foo' => config('bar.title'), ]; ``` -------------------------------- ### Check if Model is Soft Deleted Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Determines if a model instance has been soft-deleted by checking its `deleted_at` attribute using the `trashed` method. ```php if ($flight->trashed()) { // ... } ``` -------------------------------- ### Retrieve Only Soft Deleted Models (PHP) Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Uses the `onlyTrashed` method to fetch only soft-deleted model instances from the database. This is useful when you need to specifically access records that have been marked for deletion but not permanently removed. It accepts query builder methods like `where` and `get`. ```php where('airline_id', 1) ->get(); ``` -------------------------------- ### PHP Service Provider Configuration Publishing Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/packages.md Example of a PHP service provider's boot method that publishes a configuration file. The `publishes` method maps a source configuration file within the package to a destination path in the application's config directory. This allows users to override package defaults. ```php publishes([ __DIR__.'/../config/courier.php' => config_path('courier.php'), ]); } } ``` -------------------------------- ### Create and Delete Directories Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/filesystem.md Provides methods for directory management. 'makeDirectory' creates a directory, including any necessary parent directories. 'deleteDirectory' removes a directory and all of its contents. ```php use Hypervel\Support\Facades\Storage; // Create a directory Storage::makeDirectory($directory); // Delete a directory and its contents Storage::deleteDirectory($directory); ``` -------------------------------- ### Restore Soft Deleted Model Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Restores a soft-deleted model by setting its `deleted_at` column to `null`. Can be used on single models or in mass operations. ```php $flight->restore(); ``` ```php Flight::withTrashed() ->where('airline_id', 1) ->restore(); ``` ```php $flight->history()->restore(); ``` -------------------------------- ### Specify Connection and Queue for Batched Jobs Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/queues.md This example demonstrates how to configure the Redis connection and queue for a batch of jobs using the `onConnection` and `onQueue` methods. All jobs within a single batch must run on the same connection and queue. This allows for granular control over job execution environments. ```php $batch = Bus::batch([ // ... ])->then(function (Batch $batch) { // All jobs completed successfully... })->onConnection('redis')->onQueue('imports')->dispatch(); ``` -------------------------------- ### Deleting a Model Instance in PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Demonstrates how to delete a specific model record from the database by calling the `delete` method on a retrieved model instance. ```php use App\Models\Flight; $flight = Flight::find(1); $flight->delete(); ``` -------------------------------- ### Install Ably PHP SDK Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/broadcasting.md Installs the Ably PHP SDK using Composer. This is necessary for broadcasting events through Ably. ```shell composer require ably/ably-php ``` -------------------------------- ### Permanently Delete Soft Deleted Model Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Permanently removes a soft-deleted model from the database using the `forceDelete` method. This can also be used on relationship queries. ```php $flight->forceDelete(); ``` ```php $flight->history()->forceDelete(); ``` -------------------------------- ### Configure Read and Write Database Connections in PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/database.md This PHP configuration example shows how to set up separate read and write database connections. This is beneficial for performance optimization, especially in high-traffic applications, by distributing read operations to replica databases. The 'sticky' option ensures that subsequent reads after a write operation use the write connection. ```php 'mysql' => [ 'read' => [ 'host' => [ '192.168.1.1', '196.168.1.2', ], ], 'write' => [ 'host' => [ '196.168.1.3', ], ], 'sticky' => true, 'database' => env('DB_DATABASE', 'laravel'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => env('DB_CHARSET', 'utf8mb4'), 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, ] ``` -------------------------------- ### Configure SFTP Filesystem Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/filesystem.md Provides a sample configuration for an SFTP filesystem in the `filesystems.php` configuration file. It supports both basic authentication and SSH key-based authentication, along with file/directory visibility settings. ```php 'sftp' => [ 'driver' => 'sftp', 'host' => env('SFTP_HOST'), // Settings for basic authentication... 'username' => env('SFTP_USERNAME'), 'password' => env('SFTP_PASSWORD'), // Settings for SSH key based authentication with encryption password... 'privateKey' => env('SFTP_PRIVATE_KEY'), 'passphrase' => env('SFTP_PASSPHRASE'), // Settings for file / directory permissions... 'visibility' => 'private', // `private` = 0600, `public` = 0644 'directory_visibility' => 'private', // `private` = 0700, `public` = 0755 // Optional SFTP Settings... // 'hostFingerprint' => env('SFTP_HOST_FINGERPRINT'), // 'maxTries' => 4, // 'passphrase' => env('SFTP_PASSPHRASE'), // 'port' => env('SFTP_PORT', 22), // 'root' => env('SFTP_ROOT', ''), // 'timeout' => 30, // 'useAgent' => true, ], ``` -------------------------------- ### Delete Models Using Queries Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Deletes models that match query criteria or all models in a table. Mass delete operations do not dispatch model events. ```php $deleted = Flight::where('active', 0)->delete(); ``` ```php $deleted = Flight::query()->delete(); ``` -------------------------------- ### Retrieve All Records with Eloquent Model Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Use the `all` method on an Eloquent model to retrieve all records from its associated database table. The results are returned as an instance of `Hypervel\Database\Eloquent\Collection`. ```php use App\Models\Flight; foreach (Flight::all() as $flight) { echo $flight->name; } ``` -------------------------------- ### Enable Workbench Discovery Options Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/testbench.md Example of enabling specific discovery options for the Workbench in the testbench.yaml configuration. This controls the registration of routes and console commands. ```yaml workbench: discovers: web: true api: false commands: false ``` -------------------------------- ### Query Including Soft Deleted Models Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Includes soft-deleted models in query results by using the `withTrashed` method. This method can also be applied to relationship queries. ```php use App\Models\Flight; $flights = Flight::withTrashed() ->where('account_id', 1) ->get(); ``` ```php $flight->history()->withTrashed()->get(); ``` -------------------------------- ### Defining an Option with a Value Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/artisan.md This example demonstrates defining an option that expects a value, using `--queue=` syntax. The user must provide a value after the option, like `--queue=default`. If the option is not provided, its value will be `null`. This allows passing specific configurations or parameters to the command. ```PHP /** * The name and signature of the console command. * * @var null|string */ protected ?string $signature = 'mail:send {user} {--queue=}'; /** * Example of invoking the command with a value for the --queue option. * * php artisan mail:send 1 --queue=default */ ``` -------------------------------- ### Using the Cache Facade in a Controller (PHP) Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/facades.md Illustrates how to use a facade within a controller to interact with Hypervel's cache system. This example shows retrieving data using the Cache facade. ```php $user]); } } ``` -------------------------------- ### Add and Remove Soft Delete Column Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Adds or removes the `deleted_at` column from a database table using the schema builder. This column is essential for soft deletion. ```php use Hyperf\Database\Schema\Blueprint; use Hypervel\Support\Facades\Schema; Schema::table('flights', function (Blueprint $table) { $table->softDeletes(); }); ``` ```php use Hyperf\Database\Schema\Blueprint; use Hypervel\Support\Facades\Schema; Schema::table('flights', function (Blueprint $table) { $table->dropSoftDeletes(); }); ``` -------------------------------- ### Test File Uploads with Fake Storage Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/filesystem.md This example showcases how to use the Storage facade's `fake` method for testing file uploads. It involves creating fake uploaded files and asserting their presence or absence on a fake disk. ```php json('POST', '/photos', [ UploadedFile::fake()->image('photo1.jpg'), UploadedFile::fake()->image('photo2.jpg') ]); // Assert one or more files were stored... Storage::disk('photos')->assertExists('photo1.jpg'); Storage::disk('photos')->assertExists(['photo1.jpg', 'photo2.jpg']); // Assert one or more files were not stored... Storage::disk('photos')->assertMissing('missing.jpg'); Storage::disk('photos')->assertMissing(['missing.jpg', 'non-existing.jpg']); // Assert that a given directory is empty... Storage::disk('photos')->assertDirectoryEmpty('/wallpapers'); } } ``` -------------------------------- ### Iterate Over Eloquent Collections Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Eloquent collections implement PHP's iterable interfaces, allowing you to loop over them like a standard array using a `foreach` loop. ```php foreach ($flights as $flight) { echo $flight->name; } ``` -------------------------------- ### Build Log Stacks - PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/logging.md This example demonstrates how to create a 'stack' log channel in Hypervel, which aggregates messages from multiple other channels like 'syslog' and 'slack'. This allows for flexible logging configurations. ```php 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['syslog', 'slack'], ], 'syslog' => [ 'driver' => 'syslog', 'level' => 'debug', ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Hypervel Log', 'emoji' => ':boom:', 'level' => 'critical', ], ] ``` -------------------------------- ### Execute Code Before and After Task - PHP Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/scheduling.md These methods allow you to define closures that execute code just before a scheduled task starts (`before`) and just after it finishes (`after`). This is useful for setup and teardown operations. ```php $schedule->command('emails:send') ->daily() ->before(function () { // The task is about to execute... }) ->after(function () { // The task has executed... }); ``` -------------------------------- ### Enable Soft Deletes for a Model Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/eloquent.md Enables soft deletion for a model by using the `SoftDeletes` trait. This trait automatically casts the `deleted_at` attribute to a `DateTime` or `Carbon` instance. ```php ', 3)->firstOr(function () { // ... }); ``` -------------------------------- ### Display Products in Grid using Chunk (HTML/PHP) Source: https://github.com/hypervel/hypervel.org/blob/main/docs/docs/collections.md An example demonstrating how to use the `chunk` method within an HTML loop to display items in a grid layout, typically used with templating engines like Blade. ```html @foreach ($products->chunk(3) as $chunk)