Skip to content

Commit

Permalink
Fix namespace in Castables samples (#9135)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Mykhailovskyi <amykhailovskyi@brightgrove.com>
  • Loading branch information
Anton5360 and ambrightgrove authored Nov 14, 2023
1 parent 2a64317 commit b8a2d8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eloquent-mutators.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ When attaching a custom cast to a model, cast parameters may be specified by sep

You may want to allow your application's value objects to define their own custom cast classes. Instead of attaching the custom cast class to your model, you may alternatively attach a value object class that implements the `Illuminate\Contracts\Database\Eloquent\Castable` interface:

use App\Models\Address;
use App\ValueObjects\Address;

protected $casts = [
'address' => Address::class,
Expand All @@ -731,7 +731,7 @@ Objects that implement the `Castable` interface must define a `castUsing` method

<?php

namespace App\Models;
namespace App\ValueObjects;

use Illuminate\Contracts\Database\Eloquent\Castable;
use App\Casts\Address as AddressCast;
Expand All @@ -751,7 +751,7 @@ Objects that implement the `Castable` interface must define a `castUsing` method

When using `Castable` classes, you may still provide arguments in the `$casts` definition. The arguments will be passed to the `castUsing` method:

use App\Models\Address;
use App\ValueObjects\Address;

protected $casts = [
'address' => Address::class.':argument',
Expand Down

0 comments on commit b8a2d8f

Please sign in to comment.