2017 © Pedro Peláez
 

library laravel-query-param

Treats binary data in a correct way with Laravel's database system (Eloquent)

image

ooxif/laravel-query-param

Treats binary data in a correct way with Laravel's database system (Eloquent)

  • Wednesday, June 15, 2016
  • by ooxif
  • Repository
  • 1 Watchers
  • 5 Stars
  • 769 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 17 % Grown

The README.md

laravel-query-param

Treats binary data in a correct way with Laravel's database system (Eloquent)., (*1)

What laravel-query-param does

Laravel uses PDO & PDOStatement, passes parameters to PDOStatement::execute().
PDOStatement::execute() treats all parameters as PDO::PARAM_STR which breaks some binary data., (*2)

laravel-query-param overrides PDOStatement::execute() to treat binary data as PDO::PARAM_LOB., (*3)

Install

composer require "ooxif/laravel-query-param:1.0.*", (*4)

then add 'Ooxif\LaravelQueryParam\QueryParamServiceProvider', to providers in config/app.php., (*5)

Examples

// table contains a binary column
Schema::create('images', function ($table) {
    $table->increments();
    $table->timestamps();
    $table->binary('data');
});


// use ModelTrait, add '(column name)' => 'binary' to $casts
class Image extends Eloquent
{
    use Ooxif\LaravelQueryParam\ModelTrait;

    protected $table = 'images';

    protected $casts = [
        'data' => 'binary',
    ];
}


$lob = 'some binary data'; 
$image = new Image();

// setting/getting 
$image->data = $lob;
$image->data; // object(Ooxif\LaravelQueryParam\Param\ParamLob)
$image->data->value() === $lob; // true

// saving
$image->save();

// querying (model) - use param_lob()
$image = Image::where('data', param_lob($lob))->first();

// querying (db) - use param_lob()
$result = DB::table('images')->where('data', param_lob($lob))->first();
$result->data === $lob; // true

The Versions

15/06 2016

dev-master

9999999-dev

Treats binary data in a correct way with Laravel's database system (Eloquent)

  Sources   Download

MIT

The Requires

 

by Avatar ooxif

laravel eloquent

15/06 2016

1.0.3

1.0.3.0

Treats binary data in a correct way with Laravel's database system (Eloquent)

  Sources   Download

MIT

The Requires

 

by Avatar ooxif

laravel eloquent

05/06 2015

1.0.2

1.0.2.0

Treats binary data in a correct way with Laravel's database system (Eloquent)

  Sources   Download

MIT

The Requires

 

by Avatar ooxif

laravel eloquent

29/05 2015

1.0.1

1.0.1.0

Treats binary data in a correct way with Laravel's database system (Eloquent)

  Sources   Download

MIT

The Requires

 

by Avatar ooxif

laravel eloquent

29/05 2015

1.0.0

1.0.0.0

Treats binary data in a correct way with Laravel's database system (Eloquent)

  Sources   Download

MIT

The Requires

 

by Avatar ooxif

laravel eloquent