i have function form() { # there is where i would like to load my library into $form_ variable $form_ = service('Form'); <- this doesn't work - my app/libraries/form library $timer = service('Timer'); <- this works - ci service dd($form_);
}
how can i load instance of ci into this helper function?
Second question: I created app/libraries/Form.php library
<?php namespace App\Libraries;
class Form { protected $validation = false;
public function __construct() { $this->validation = []; }
public function validations() { $this->validation['peter'] = 'test'; return $this->validation; }
public function add($name,$rules) { echo "OKa"; die; $this->validation[$name] = $rules; }
}
how can i load this library in my helper function form?