Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lse123's avatar

Having two php framework apps 2 or 1 database

Having two PHP framework apps[old CakePHP 3.1.x and new Laravel 8.x] during moving to be in Laravel only.

The PHP frameworks are for the admin - Users/Customers web pages are developed with plain PHP

Some differences in DB tables exist eg Users [app is about holiday Apts/Villas rentals]

Are you recommend have 2 or 1 database(s)...? In case 1 database I may having two users tables named differently and change the default users table in Laravel: have >>>> // how to change default table name of users????

composer require laravel/jetstream

// Install Jetstream with the Livewire stack...

php artisan jetstream:install livewire

0 likes
7 replies
automica's avatar

@lse123 try an keep a single source of truth with your users table. From my memory, cakephp and Laravel are quite similar in table names, but it would make sense to modify Laravel models so they use the cakephp tables. You can can specify the table if its not default by

    protected $table = 'my_odd_table_name';

You'll need to customize Laravel Authentication to use the same hashing for passwords and secret key.

I'd then create additional functionality in Laravel to match the cakephp functionality, and then retire the cakephp admin.

Once that's complete, you can rename the Laravel tables, FKs and modify the front end to use the Laravel table names + new columns on your joins.

As you build you new admin, be sure to cover its functionality with tests, as that will be essential when you modify the tables and retire your cakephp app.

lse123's avatar

User is Only One the Admin, [customers only book without being in users table], so having two users tables is also fine.

if choose to have two users tables :

users // CakePHP

users_laravel

given auth in Laravel done with:

composer require laravel/jetstream

php artisan jetstream:install livewire

how in Laravel/jetstream/livewire/ do change the default users table name?

automica's avatar
automica
Best Answer
Level 54

@lse123 put this in your User model:

    protected $table = 'users_laravel';
laracoft's avatar

@lse123

  1. Is the app currently in production? I'm assuming yes
  2. Does your Cake tables have a prefix?

I think a safest setup is to have 2 DB:

  1. It prevents Laravel from messing up cake tables
  2. It allows cake to still run as-is in production
  3. If users table is the only concern, just create a script to copy it from Cake to Laravel at regular intervals.

If that is too tough and cake tables have a prefix, it will be easy to share 1 DB between Laravel and Cake.

If cake tables have no prefix, then it becomes very tricky for the developer as mistakes can create chaos.

siangboon's avatar

duplicate a database is just much easier, faster and safer...

lse123's avatar

The login user is ONE and is the ADMIN. tables have No prefix but I can RENAME/COPY Manually.

CakePHP app the logged-in Admin will maintain all about properties except Discounts, hence Discounts will be maintained from Laravel

So in other words, Laravel sub-dom2.rentalsyyy.com and CakePHP sub-dom1.rentalsyyy.com will have separate users table MySQL [users_laravel, users] but share the same Discounts table

Laravel eventually [future] will be maintaining all DB... and CakePHP removed.

laracoft's avatar

@lse123 is your issue addressed now? If yes please pick a best answer. Thank you.

Please or to participate in this conversation.