Category : relationship

Here’s the problem: /** * Get all of the clothes for the Selling * * @return IlluminateDatabaseEloquentRelationsHasMany */ public function clothes(): HasMany { return $this->hasMany(Cloth::class); } I need to make this relationship accept more than one type of model, something like this: /** * Get all of the products for the Selling * * @return ..

Read more

I am trying to implement a created_by column in my users’ table. I created a migration file to add the new column to the users’ table: public function up() { Schema::table(‘users’, function (Blueprint $table) { $table->unsignedInteger(‘created_by’)->default(0); }); } I have a User model which has the following relationships: public function roles() { return $this->belongsToMany(Role::class); } ..

Read more

New to Laravel. I have the following tables. products ( id ) attributes ( id, name ) attribute_values( id, attribute_id, value ) products_attributes ( product_id, attribute_value_id ) I can able to get the product details along with its categories attribute name and value with everything.(it has translations also) Now need to perform the search operation. ..

Read more

New to Laravel. I have the following tables. products ( id ) attributes ( id, name ) attribute_values( id, attribute_id, value ) products_attributes ( product_id, attribute_value_id ) I can able to get the product details along with its categories attribute name and value with everything.(it has translations also) Now need to perform the search operation. ..

Read more