mirror of
https://github.com/flarum/framework.git
synced 2025-02-24 02:05:26 +08:00
Allow settings to be deleted using LIKE
Also give migrations access to the SettingsRepository
This commit is contained in:
parent
6cacf37d0d
commit
6ddd99dca5
@ -45,8 +45,8 @@ class DatabaseSettingsRepository implements SettingsRepository
|
||||
$query->$method(compact('key', 'value'));
|
||||
}
|
||||
|
||||
public function delete($key)
|
||||
public function delete($keyLike)
|
||||
{
|
||||
$this->database->table('config')->where('key', $key)->delete();
|
||||
$this->database->table('config')->where('key', 'like', $keyLike)->delete();
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ interface SettingsRepository
|
||||
|
||||
public function set($key, $value);
|
||||
|
||||
public function delete($key);
|
||||
public function delete($keyLike);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
namespace Flarum\Migrations;
|
||||
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
use Flarum\Core\Settings\SettingsRepository;
|
||||
|
||||
abstract class Migration
|
||||
{
|
||||
@ -19,8 +20,14 @@ abstract class Migration
|
||||
*/
|
||||
protected $schema;
|
||||
|
||||
public function __construct(Builder $builder)
|
||||
/**
|
||||
* @var SettingsRepository
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
public function __construct(Builder $schema, SettingsRepository $settings)
|
||||
{
|
||||
$this->schema = $builder;
|
||||
$this->schema = $schema;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user