PHP code example of opoink / oliv
1. Go to this page and download the library: Download opoink/oliv 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/ */
opoink / oliv example snippets
return [
[
'name' => 'my_event_name', // event name
'listener' => \Plugins\<VendorName\>\<PluginName>\EventListeners\MyEventListener::class, // event handler class
'sort_order' => 10
]
]
namespace Plugins\<VendorName>\<PluginName>\EventListeners;
class MyEventListener {
public function handle(\Opoink\Oliv\Lib\DataObject $data){
...
$myData = $data->getData('my_data');
...
}
}
return [
[
'name' => 'Plugins_Opoink_Liv_Lib_Facades_Event_Login_authUser', // event name
'listener' => \Plugins\<VendorName\>\<PluginName>\EventListeners\MyEventListener::class, // event handler class
'sort_order' => 1
]
]
namespace Plugins\<VendorName>\<PluginName>\EventListeners;
class MyEventListener {
public function handle(\Opoink\Oliv\Lib\DataObject $data){
$request = $data->getData('request');
$username = $request->input('email');
$password = $request->input('password');
$isValid = /** your validation login */;
if($isValid){
$myModelAuthenticatable = new \Plugins\<VendorName>\<PluginName>\Models\MyModelAuthenticatable()
auth()->guard('admin')->login($myModelAuthenticatable);
}
}
}