Add migration to add 'fa fa-' to group icons (#1597)

* Add migration to add 'fa fa-' (FA v4 shim) to group icons

* StyleCI

* Change prefix to `fas fa-`
This commit is contained in:
David Sevilla Martín 2018-10-09 18:39:19 -04:00 committed by Franz Liedke
parent a900bf5ffa
commit 5f785c9473

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Schema\Builder;
return [
'up' => function (Builder $schema) {
$groups = $schema->getConnection()->table('groups')
->where('icon', '<>', '')
->where('icon', 'NOT LIKE', '%fa-%')
->select('id', 'icon')
->cursor();
foreach ($groups as $group) {
$schema->getConnection()->table('groups')
->where('id', $group->id)
->update([
'icon' => 'fas fa-'.$group->icon
]);
}
},
'down' => function (Builder $schema) {
//
}
];