You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I want to use laravel validation standalone in codeigniter3. this is code I used:
<?php
include APPPATH . 'vendor/autoload.php';
use Illuminate\Validation\DatabasePresenceVerifier;
use Illuminate\Validation;
use Illuminate\Translation;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Eloquent as Eloquent;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
class ValidatorFactory
{
private $factory;
public function __construct()
{
$this->factory = new Validation\Factory(
$this->loadTranslator()
);
}
protected function loadTranslator()
{
$filesystem = new Filesystem();
$loader = new Translation\FileLoader(
$filesystem,
dirname(dirname(__FILE__)) . '/language'
);
$loader->addNamespace(
'language',
dirname(dirname(__FILE__)) . '/language'
);
$loader->load('english', 'validation', 'language');
return new Translation\Translator($loader, 'english');
}
public function __call($method, $args)
{
return call_user_func_array(
[$this->factory, $method],
$args
);
}
}
but in this way, validation rule related to database like exists, unique and ... does not work.
I tested several ways like using Capsule and setPresenceVerifier together but does not work too.
could you help me to enable database for validation?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I want to use laravel validation standalone in codeigniter3. this is code I used:
but in this way, validation rule related to database like exists, unique and ... does not work.
I tested several ways like using Capsule and setPresenceVerifier together but does not work too.
could you help me to enable database for validation?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions