Send first row to a blade and update only one row

Hello! I have a view which only consists in fields such as general information that is not often updated. Which is why I think it would be best to have only 1 row in the table of the database instead of creating multiple rows and update only that row, however, when I set the table to have only 1 row in workbench does changes are not permanent and continues to add more rows. So then I decided to only display the first row and update that first row but I’m having trouble with the livewire controller sending that first row to the blade.

I’m using laravel and livewire 2.0

Here is the render function of the livewire controller:

public function render($modelId) {

        return view('livewire.info-magister',[

            'infomag'=> InfoMagister::where($this->modelId)->first(),

            paginate()

        ]);

    }

public function update($modelId)

    {

        $this->validate();

        $this->unassignDefaultHomePage();

        $this->unassignDefaultNotFoundPage();

        InfoMagister::find($this->modelId)->update($this->modelData()->first());

        $this->modalFormVisible = false;

    }

the route:

Route::middleware(['auth:sanctum', 'verified'])

    ->get('/informacion-general', InfoMag::class)

    ->name('informacion');

and the blade button:

<button wire:click="update" class="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">

                                            Save

                                        </button>

and I get this error even though $modelId has been declared in the class

Illuminate\Contracts\Container\BindingResolutionException

Unable to resolve dependency [Parameter #0 [ $modelId ]] in class App\Http\Livewire\InfoMag

I would also like to know how to display only that row in the blade instead of using foreach. Thank you in advance!

Hey, @bh_92

Don’t insert any parameters to the render method, if you want to define a property inside your component use public/protected properties depends on your needs.