123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- // Copyright 2019 Hackware SpA <https://hackware.cl>.
- // This file is part of "Hackware's Digital Wallet" and licensed under the
- // terms of the GNU Affero General Public License version 3, or (at your
- // option) a later version. You should have received a copy of this license
- // along with the software. If not, see <https://www.gnu.org/licenses/>.
- namespace Hawese\Seeds;
- use Hawese\Core\Exceptions\ModelObjectNotFoundException;
- use Hawese\Wallet\Currency;
- use Illuminate\Database\Seeder;
- class CurrenciesTableSeeder extends Seeder
- {
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- try {
- $currency = Currency::findByCode('CLP');
- } catch (ModelObjectNotFoundException $ex) {
- $currency = new Currency(
- ['code' => 'CLP', 'rate' => 1, 'step' => 50]
- );
- $currency->insert();
- }
- try {
- $currency = Currency::findByCode('USD');
- } catch (ModelObjectNotFoundException $ex) {
- $currency = new Currency(
- ['code' => 'USD', 'rate' => 1, 'step' => 0.01]
- );
- $currency->insert();
- }
- }
- }
|