Laravel Créer une vue de migration
class CreateCompaniesView extends Migration
{
public function up()
{
DB::statement("CREATE VIEW companiesView AS
SELECT *,
(
SELECT GROUP_CONCAT(DISTINCT id SEPARATOR ',')
FROM people AS p
WHERE p.company_id = c.id
) AS person_ids
FROM companies AS c");
}
public function down()
{
DB::statement("DROP VIEW companiesView");
}
}
Bug Killer