Looking to hire Laravel developers? Try LaraJobs

laravel-schema-real-binary maintained by noud

Description
Laravel case sensive Schema column type
Last update
2020/09/11 00:57 (dev-master)
License
Links
Downloads
6

Comments
comments powered by Disqus

Laravel realBinary, case sensitive string, Schema column type

INSERT INTO `country` (`id`, `currency`) VALUES
('demo', 'eur'),
('be', 'EUR'),
('nl', 'EUR');

INSERT INTO `currency` (`code`, `symbol`, `format`) VALUES
('eur', '€', '{VALUE} {SYMBOL}'),
('EUR', '€', '{SYMBOL} {VALUE}'),
('USD', '$', '{SYMBOL} {VALUE}');

Creating Columns

This Laravel package gives case sensative string fields with length and also as primary and foreign key by adding a real binary column to migrations.

migrations

    Schema::create('currency', function (Blueprint $table) {
        $table->realBinary('code', 3)->unique();
        // works as well
        // $table->char('code', 3)->charset('binary')->unique();
        // more fields
    });

    Schema::create('country', function (Blueprint $table) {
        $table->string('id')->unique();
        $table->realBinary('currency', 3);
        // works as well
        // $table->char('currency', 3)->charset('binary');

        $table->foreign('currency')->references('code')->on('currency');
    });

New Column Type

Available Column Type

used together with

inspirations

This Laravel package is inspired by