Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

In case anyone else stumbles across this...

$tbl is outside of the anonymous function's scope that is being passed to the Schema::table method. In order to access it within the anonymous function add use ($tbl) after the function's parameter definition:

Schema::table($tbl['tableName'], function(Blueprint $table) use ($tbl) {
    foreach ($tbl['foreignKeys'] as $key)
    {
        $table->dropForeign($tbl['tableName'].'_'.$key.'_foreign'); 
    }
    ...
});
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.

© 2024 Laravel.io - All rights reserved.