Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 1 year 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.