PHP code example of fanmade / laravel-bitwise-trait
1. Go to this page and download the library: Download fanmade/laravel-bitwise-trait library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fanmade / laravel-bitwise-trait example snippets
$table->tinyInteger('status'); // 1 byte -> maximum of 7 different values
$table->unsignedTinyInteger('status'); // maximum of 8 different values
$table->smallInteger('status'); // 2 byte -> maximum of 16 different values
$table->unsignedSmallInteger('status'); // maximum of 17 different values
$table->mediumInteger('status'); // 3 byte -> maximum of 24 different values
namespace App;
use Fanmade\Bitwise\BitwiseFlagTrait;
class Message extends Model
{
use BitwiseFlagTrait;
const MESSAGE_SENT = 1; // BIT #1 of has the value 1
const MESSAGE_RECEIVED = 2; // BIT #2 of has the value 2
const MESSAGE_SEEN = 4; // BIT #3 of has the value 4
const MESSAGE_READ = 8; // BIT #4 of has the value 8