skip to Main Content

Laravel 8.x realationship – Use HasMany in HasOne

I'm trying to use a HasMany relation in a HasOne. I have following Models: class Auction extends Model { //... public function bids(): HasMany { return $this->hasMany(Bid::class, 'auction_id'); } public function approvedBids(): HasMany { return $this->bids()->approved(); } public function topBids():…

VIEW QUESTION

update content of stored column in laravel controller

I have a table with 3 columns: firstname lastname fullname in migration: Schema::create('owners', function (Blueprint $table) { $table->id(); $table->string('firstname',20); $table->string('lastname', 20); $table->string('fullname')->storedAs('CONCAT(firstname,lastname)'); $table->timestamps(); }); the problem is that i want to change the concatenation order in the controller i tried…

VIEW QUESTION
Back To Top
Search