Skip to content

Code Highlighting

<?php
declare(strict_types=1);
namespace App\Actions\Fortify;
use App\Concerns\PasswordValidationRules;
use App\Concerns\ProfileValidationRules;
use App\Models\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\CreatesNewUsers;
class CreateNewUser implements CreatesNewUsers
{
use PasswordValidationRules;
use ProfileValidationRules;
/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
*/
public function create(array $input): User
{
Validator::make($input, [
...$this->profileRules(),
'surname' => $this->surnameRules(),
'password' => $this->passwordRules(),
])->validate();
return DB::transaction(function () use ($input): User {
$user = User::create([
'name' => $input['name'],
'surname' => $input['surname'],
'email' => $input['email'],
'password' => $input['password'],
'username' => $input['username'],
'legacy_id' => $input['legacy_id'],
]);
$user->assignRole('customer');
return $user;
});
}
}

Apply these values as the new defaults in the useDialKit call.

Highlights every occurrence of the given text, not full lines.

$user->assignRole('customer');
$user->assignRole('customer');

Typed variants: mark="text", ins="text", del="text".

'username' => $input['username'],
'legacy_id' => $input['legacy_id'],

Same as plaintext, but wrapped in slashes.

$user->assignRole('customer');

No line numbers needed — prefix lines directly. Add lang="php" (or any lang) to keep syntax highlighting instead of falling back to diff.

$user = User::create([
'name' => $input['name'],
'legacy_id' => $input['legacy_id'],
'username' => $input['username'],
]);
app/Actions/Fortify/CreateNewUser.php
class CreateNewUser implements CreatesNewUsers
{
}
Terminal window
php artisan migrate

Collapses lines 2-4 behind a “show more” toggle.

<?php
3 collapsed lines
use App\Concerns\PasswordValidationRules;
use App\Concerns\ProfileValidationRules;
class CreateNewUser
{
}
$user = User::create(['name' => $input['name'], 'surname' => $input['surname'], 'email' => $input['email']]);

Overrides the global showLineNumbers setting for a single fence.

$user->assignRole('customer');

The collapse plugin’s toggle is one-way — once expanded it stays open. For a block that can be closed again, wrap it in raw HTML <details>/<summary> instead of using collapse={}.

Show migration command
Terminal window
php artisan migrate