Support the ongoing development of Laravel.io →
posted 6 years ago
Laravel

Is there any possible way to generate database from models in Laravel ? I am working on an existing laravel project,it contains models without their migrations.

Last updated 3 years ago.
0

//write this code in your model

if (!Schema::hasTable('table_name')) { Schema::create("users", function($table) { $table->increments("id"); $table->string("username", 32); $table->string("email", 320); $table->string("password", 64); $table->timestamps(); }); } // hope its working

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.