Posterior a investigar con especialistas en este tema, programadores de varias áreas y profesores dimos con la solución al problema y la dejamos plasmada en este post.
Ejemplo: modelo de tabla dinámica de laravel
/*Model - Service*/publicfunctioncustomer()return$this->belongsToMany('customer')->withPivot('start_date','stop_date','rem_date','due_date','status');/*Model - customer*/publicfunctionservices()return$this->belongsToMany('Service')->withPivot('start_date','stop_date','rem_date','due_date','status');////These following relations didnt workout/*Model - custserv*///uses the pivot table customer_service//publicfunctionstaff()return$this->belongsToMany('Staff');/*Model - Staff*/publicfunctioncustservs()return$this->belongsToMany('Custserv');/*schema for pivot table 'staff' and 'Custserv' */Schema::create('customer_service_user',function(Blueprint$table)$table->increments('id');$table->integer('customer_service_id')->unsigned()->index();$table->foreign('customer_service_id')->references('id')->on('customer_service')->onDelete('cascade');$table->integer('staff_id')->unsigned()->index();$table->foreign('staff_id')->references('id')->on('staff')->onDelete('cascade');$table->timestamps(););
Eres capaz de añadir valor a nuestro contenido informacional contribuyendo tu experiencia en las ilustraciones.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)