Skip to content

Getting a field value from database in relation manager #9235

Answered by haiffy420
haiffy420 asked this question in Help
Discussion options

You must be logged in to vote

Found the solution from this Laracasts post

use Livewire\Component as Livewire;

Forms\Components\TextInput::make('kunjungan')
          ->label('Number of visits')
          ->default(
              function () {
                    function (Livewire $livewire) {
                         $livewire->ownerRecord;
                    };
              return \App\Models\Visit::query()->where('baby_id', $this->ownerRecord->id)->count() + 1;
              }
          ),

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@haiffy420
Comment options

Comment options

You must be logged in to vote
2 replies
@leandrocfe
Comment options

@haiffy420
Comment options

Answer selected by haiffy420
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants