gravatar bug fixes
This commit is contained in:
113
code/vendor/chumper/datatable/tests/Engines/BaseEngineTest.php
vendored
Normal file
113
code/vendor/chumper/datatable/tests/Engines/BaseEngineTest.php
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
use Chumper\Datatable\Engines\CollectionEngine;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Orchestra\Testbench\TestCase;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class BaseEngineTest extends TestCase {
|
||||
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* @var CollectionEngine
|
||||
*/
|
||||
private $engine;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
// set up config
|
||||
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.engine")->andReturn(
|
||||
array(
|
||||
'exactWordSearch' => false,
|
||||
)
|
||||
);
|
||||
|
||||
$this->collection = new Collection();
|
||||
$this->engine = new CollectionEngine($this->collection);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testAddColumn()
|
||||
{
|
||||
$this->engine->addColumn('foo', 'bar');
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Chumper\Datatable\Columns\TextColumn',
|
||||
$this->engine->getColumn('foo')
|
||||
);
|
||||
|
||||
$this->engine->addColumn('foo2', function($model){return $model->fooBar;});
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Chumper\Datatable\Columns\FunctionColumn',
|
||||
$this->engine->getColumn('foo2')
|
||||
);
|
||||
|
||||
$this->assertEquals(array(1 => 'foo2', 0 => 'foo'), $this->engine->getOrder());
|
||||
|
||||
$this->engine->addColumn();
|
||||
}
|
||||
|
||||
public function testClearColumns()
|
||||
{
|
||||
$this->engine->addColumn('foo','Bar');
|
||||
$this->assertInstanceOf(
|
||||
'Chumper\Datatable\Columns\TextColumn',
|
||||
$this->engine->getColumn('foo')
|
||||
);
|
||||
|
||||
$this->engine->clearColumns();
|
||||
$this->assertEquals(array(), $this->engine->getOrder());
|
||||
}
|
||||
|
||||
public function testSearchColumns()
|
||||
{
|
||||
$this->engine->searchColumns('id');
|
||||
|
||||
$this->assertEquals(array('id'), $this->engine->getSearchingColumns());
|
||||
|
||||
$this->engine->searchColumns('name', 'email');
|
||||
|
||||
$this->assertEquals(array('name','email'), $this->engine->getSearchingColumns());
|
||||
|
||||
$this->engine->searchColumns(array('foo', 'bar'));
|
||||
|
||||
$this->assertEquals(array('foo', 'bar'), $this->engine->getSearchingColumns());
|
||||
}
|
||||
|
||||
public function testOrderColumns()
|
||||
{
|
||||
$this->engine->orderColumns('id');
|
||||
|
||||
$this->assertEquals(array('id'), $this->engine->getOrderingColumns());
|
||||
|
||||
$this->engine->orderColumns('name', 'email');
|
||||
|
||||
$this->assertEquals(array('name','email'), $this->engine->getOrderingColumns());
|
||||
|
||||
$this->engine->orderColumns(array('foo', 'bar'));
|
||||
|
||||
$this->assertEquals(array('foo', 'bar'), $this->engine->getOrderingColumns());
|
||||
}
|
||||
|
||||
public function testShowColumns()
|
||||
{
|
||||
$this->engine->showColumns('id');
|
||||
|
||||
$this->assertEquals(array('id'), $this->engine->getOrder());
|
||||
|
||||
$this->engine->showColumns('name', 'email');
|
||||
|
||||
$this->assertEquals(array('id','name','email'), $this->engine->getOrder());
|
||||
|
||||
$this->engine->showColumns(array('foo', 'bar'));
|
||||
|
||||
$this->assertEquals(array('id','name','email', 'foo', 'bar'), $this->engine->getOrder());
|
||||
}
|
||||
}
|
||||
|
||||
328
code/vendor/chumper/datatable/tests/Engines/CollectionEngineTest.php
vendored
Normal file
328
code/vendor/chumper/datatable/tests/Engines/CollectionEngineTest.php
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
<?php
|
||||
|
||||
use Chumper\Datatable\Columns\FunctionColumn;
|
||||
use Chumper\Datatable\Engines\CollectionEngine;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Orchestra\Testbench\TestCase;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class CollectionEngineTest extends TestCase {
|
||||
|
||||
/**
|
||||
* @var CollectionEngine
|
||||
*/
|
||||
public $c;
|
||||
|
||||
/**
|
||||
* @var \Mockery\Mock
|
||||
*/
|
||||
public $collection;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $input;
|
||||
|
||||
protected function getEnvironmentSetUp($app)
|
||||
{
|
||||
$app['config']->set('chumper.datatable.engine', array(
|
||||
'exactWordSearch' => false,
|
||||
));
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->collection = Mockery::mock('Illuminate\Support\Collection');
|
||||
$this->c = new CollectionEngine($this->collection);
|
||||
}
|
||||
|
||||
public function testOrder()
|
||||
{
|
||||
$should = array(
|
||||
array(
|
||||
'id' => 'eoo'
|
||||
),
|
||||
array(
|
||||
'id' => 'foo'
|
||||
)
|
||||
);
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'iSortCol_0' => 0,
|
||||
'sSortDir_0' => 'asc',
|
||||
)
|
||||
);
|
||||
|
||||
$engine = new CollectionEngine(new Collection($this->getTestArray()));
|
||||
$engine->addColumn(new FunctionColumn('id', function($model){return $model['id'];}));
|
||||
$engine->setAliasMapping();
|
||||
$this->assertEquals($should, $engine->getArray());
|
||||
|
||||
Input::merge(
|
||||
array(
|
||||
'iSortCol_0' => 0,
|
||||
'sSortDir_0' => 'desc'
|
||||
)
|
||||
);
|
||||
|
||||
$should2 = array(
|
||||
array(
|
||||
'id' => 'foo'
|
||||
),
|
||||
array(
|
||||
'id' => 'eoo'
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals($should2, $engine->getArray());
|
||||
|
||||
}
|
||||
|
||||
public function testSearch()
|
||||
{
|
||||
// Facade expection
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'eoo'
|
||||
)
|
||||
);
|
||||
|
||||
$engine = new CollectionEngine(new Collection($this->getTestArray()));
|
||||
$engine->addColumn($this->getTestColumns());
|
||||
$engine->searchColumns('id');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
$should = '{"aaData":[{"id":"eoo"}],"sEcho":0,"iTotalRecords":2,"iTotalDisplayRecords":1}';
|
||||
$actual = $engine->make()->getContent();
|
||||
|
||||
$this->assertEquals($should,$actual);
|
||||
//------------------TEST 2-----------------
|
||||
// search in outputed data
|
||||
$engine = new CollectionEngine(new Collection(array(array('foo', 'foo2', 'foo3'),array('bar', 'bar2', 'bar3'))));
|
||||
$engine->addColumn(new FunctionColumn('bla', function($row){return $row[0]." - ".$row[1];}));
|
||||
$engine->addColumn(new FunctionColumn('1', function($row){return $row[2];}));
|
||||
$engine->addColumn(new FunctionColumn('bla3', function($row){return $row[0]." - ".$row[2];}));
|
||||
$engine->searchColumns("bla",1);
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'foo2'
|
||||
)
|
||||
);
|
||||
|
||||
$should = array(
|
||||
array(
|
||||
'bla' => 'foo - foo2',
|
||||
'1' => 'foo3',
|
||||
'bla3' => 'foo - foo3'
|
||||
)
|
||||
);
|
||||
|
||||
$response = json_decode($engine->make()->getContent());
|
||||
$this->assertEquals(json_encode($should), json_encode((array)($response->aaData)));
|
||||
|
||||
//------------------TEST 3-----------------
|
||||
// search in initial data
|
||||
// TODO: Search in initial data columns?
|
||||
|
||||
$engine = new CollectionEngine(new Collection(array(array('foo', 'foo2', 'foo3'),array('bar', 'bar2', 'bar3'))));
|
||||
$engine->addColumn(new FunctionColumn('bla3', function($row){return $row[0]." - ".$row[2];}));
|
||||
$engine->addColumn(new FunctionColumn('1', function($row){return $row[1];}));
|
||||
$engine->searchColumns("bla3",1);
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'foo2'
|
||||
)
|
||||
);
|
||||
|
||||
$should = array(
|
||||
array(
|
||||
'bla3' => 'foo - foo3',
|
||||
'1' => 'foo2'
|
||||
)
|
||||
);
|
||||
|
||||
$response = json_decode($engine->make()->getContent());
|
||||
$this->assertEquals(json_encode($should), json_encode($response->aaData));
|
||||
}
|
||||
|
||||
public function testSkip()
|
||||
{
|
||||
$engine = new CollectionEngine(new Collection($this->getTestArray()));
|
||||
|
||||
$engine->addColumn($this->getTestColumns());
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'iDisplayStart' => 1
|
||||
)
|
||||
);
|
||||
|
||||
$should = array(
|
||||
array(
|
||||
'id' => 'eoo',
|
||||
)
|
||||
);
|
||||
$this->assertEquals($should, $engine->getArray());
|
||||
}
|
||||
|
||||
public function testTake()
|
||||
{
|
||||
Input::replace(
|
||||
array(
|
||||
'iDisplayLength' => 1
|
||||
)
|
||||
);
|
||||
|
||||
$engine = new CollectionEngine(new Collection($this->getTestArray()));
|
||||
$engine->addColumn($this->getTestColumns());
|
||||
$engine->setAliasMapping();
|
||||
$engine->make();
|
||||
|
||||
$should = array(
|
||||
array(
|
||||
'id' => 'foo',
|
||||
)
|
||||
);
|
||||
$this->assertEquals($should, $engine->getArray());
|
||||
}
|
||||
|
||||
public function testComplex()
|
||||
{
|
||||
$engine = new CollectionEngine(new Collection($this->getRealArray()));
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 't'
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',(array) $test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',(array) $test));
|
||||
|
||||
//Test2
|
||||
$engine = new CollectionEngine(new Collection($this->getRealArray()));
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'plasch'
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',(array) $test));
|
||||
$this->assertFalse($this->arrayHasKeyValue('foo','Taylor',(array) $test));
|
||||
|
||||
//test3
|
||||
$engine = new CollectionEngine(new Collection($this->getRealArray()));
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'tay'
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
|
||||
|
||||
$this->assertFalse($this->arrayHasKeyValue('foo','Nils',(array) $test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',(array) $test));
|
||||
|
||||
//test4
|
||||
$engine = new CollectionEngine(new Collection($this->getRealArray()));
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'O'
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertFalse($this->arrayHasKeyValue('foo','Nils',(array) $test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',(array) $test));
|
||||
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
Mockery::close();
|
||||
}
|
||||
|
||||
private function getTestArray()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'id' => 'foo'
|
||||
),
|
||||
array(
|
||||
'id' => 'eoo'
|
||||
)
|
||||
);
|
||||
}
|
||||
private function getRealArray()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'name' => 'Nils Plaschke',
|
||||
'email'=> 'github@nilsplaschke.de'
|
||||
),
|
||||
array(
|
||||
'name' => 'Taylor Otwell',
|
||||
'email'=> 'taylorotwell@gmail.com'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function addRealColumns($engine)
|
||||
{
|
||||
$engine->addColumn(new FunctionColumn('foo', function($m){return $m['name'];}));
|
||||
$engine->addColumn(new FunctionColumn('bar', function($m){return $m['email'];}));
|
||||
}
|
||||
|
||||
private function getTestColumns()
|
||||
{
|
||||
return new FunctionColumn('id', function($row){return $row['id'];});
|
||||
}
|
||||
|
||||
private function arrayHasKeyValue($key,$value,$array)
|
||||
{
|
||||
$array = array_pluck($array,$key);
|
||||
foreach ($array as $val)
|
||||
{
|
||||
if(str_contains($val, $value))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
251
code/vendor/chumper/datatable/tests/Engines/QueryEngineTest.php
vendored
Normal file
251
code/vendor/chumper/datatable/tests/Engines/QueryEngineTest.php
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
use Chumper\Datatable\Columns\FunctionColumn;
|
||||
use Chumper\Datatable\Engines\BaseEngine;
|
||||
use Chumper\Datatable\Engines\EngineInterface;
|
||||
use Chumper\Datatable\Engines\QueryEngine;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class QueryEngineTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @var QueryEngine
|
||||
*/
|
||||
public $c;
|
||||
|
||||
/**
|
||||
* @var \Mockery\Mock
|
||||
*/
|
||||
public $builder;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
||||
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.engine")->andReturn(
|
||||
array(
|
||||
'exactWordSearch' => false,
|
||||
)
|
||||
);
|
||||
|
||||
$this->builder = Mockery::mock('Illuminate\Database\Query\Builder');
|
||||
|
||||
$this->c = new QueryEngine($this->builder);
|
||||
}
|
||||
|
||||
public function testOrder()
|
||||
{
|
||||
$this->builder->shouldReceive('orderBy')->with('id', BaseEngine::ORDER_ASC);
|
||||
|
||||
Input::merge(
|
||||
array(
|
||||
'iSortCol_0' => 0,
|
||||
'sSortDir_0' => 'asc'
|
||||
)
|
||||
);
|
||||
|
||||
//--
|
||||
|
||||
$this->builder->shouldReceive('orderBy')->with('id', BaseEngine::ORDER_DESC);
|
||||
|
||||
Input::merge(
|
||||
array(
|
||||
'iSortCol_0' => 0,
|
||||
'sSortDir_0' => 'desc'
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function testSearch()
|
||||
{
|
||||
$this->builder->shouldReceive('where')->withAnyArgs()->andReturn($this->builder);
|
||||
$this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
|
||||
$this->builder->shouldReceive('count')->twice()->andReturn(10);
|
||||
$this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
|
||||
|
||||
$this->c = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($this->c);
|
||||
$this->c->searchColumns('foo');
|
||||
|
||||
Input::merge(
|
||||
array(
|
||||
'sSearch' => 'test'
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($this->c->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
}
|
||||
|
||||
public function testSkip()
|
||||
{
|
||||
$this->builder->shouldReceive('skip')->once()->with(1)->andReturn($this->builder);
|
||||
$this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
|
||||
$this->builder->shouldReceive('count')->twice()->andReturn(10);
|
||||
$this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
|
||||
|
||||
$this->c = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($this->c);
|
||||
|
||||
Input::merge(
|
||||
array(
|
||||
'iDisplayStart' => 1,
|
||||
'sSearch' => null
|
||||
)
|
||||
);
|
||||
|
||||
$this->c->searchColumns('foo');
|
||||
|
||||
$test = json_decode($this->c->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
}
|
||||
|
||||
public function testTake()
|
||||
{
|
||||
$this->builder->shouldReceive('take')->once()->with(1)->andReturn($this->builder);
|
||||
$this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
|
||||
$this->builder->shouldReceive('count')->twice()->andReturn(10);
|
||||
$this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
|
||||
|
||||
$this->c = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($this->c);
|
||||
|
||||
Input::merge(
|
||||
array(
|
||||
'iDisplayLength' => 1,
|
||||
'sSearch' => null,
|
||||
'iDisplayStart' => null
|
||||
)
|
||||
);
|
||||
|
||||
$this->c->searchColumns('foo');
|
||||
|
||||
$test = json_decode($this->c->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
}
|
||||
|
||||
public function testComplex()
|
||||
{
|
||||
|
||||
|
||||
$this->builder->shouldReceive('get')->andReturn(new Collection($this->getRealArray()));
|
||||
$this->builder->shouldReceive('where')->withAnyArgs()->andReturn($this->builder);
|
||||
$this->builder->shouldReceive('count')->times(8)->andReturn(10);
|
||||
|
||||
$engine = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 't',
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
|
||||
|
||||
//Test2
|
||||
$engine = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'plasch',
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
|
||||
|
||||
//test3
|
||||
$engine = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => 'tay',
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
|
||||
|
||||
//test4
|
||||
$engine = new QueryEngine($this->builder);
|
||||
|
||||
$this->addRealColumns($engine);
|
||||
$engine->searchColumns('foo','bar');
|
||||
$engine->setAliasMapping();
|
||||
|
||||
Input::replace(
|
||||
array(
|
||||
'sSearch' => '0',
|
||||
)
|
||||
);
|
||||
|
||||
$test = json_decode($engine->make()->getContent());
|
||||
$test = $test->aaData;
|
||||
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
|
||||
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
Mockery::close();
|
||||
}
|
||||
|
||||
private function getRealArray()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'name' => 'Nils Plaschke',
|
||||
'email'=> 'github@nilsplaschke.de'
|
||||
),
|
||||
array(
|
||||
'name' => 'Taylor Otwell',
|
||||
'email'=> 'taylorotwell@gmail.com'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function addRealColumns($engine)
|
||||
{
|
||||
$engine->addColumn(new FunctionColumn('foo', function($m){return $m['name'];}));
|
||||
$engine->addColumn(new FunctionColumn('bar', function($m){return $m['email'];}));
|
||||
}
|
||||
|
||||
private function arrayHasKeyValue($key,$value,$array)
|
||||
{
|
||||
$array = array_pluck($array,$key);
|
||||
foreach ($array as $val)
|
||||
{
|
||||
if(str_contains($val, $value))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user