1. Go to this page and download the library: Download ccmelas/laravel-sharenet 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/ */
ccmelas / laravel-sharenet example snippets
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Sharenet;
class TestController extends Controller
{
public function index()
{
$data = [
'to' => '08034503911',
'from' => 'Melas',
'message' => 'This is a test message'
];
Sharenet::send($data);
}
}
// App/Notifications/TestNotification
use Melas\Sharenet\Channels\SharenetChannel;
...
public function via($notifiable)
{
return [SharenetChannel::class];
}
public function toSharenet($notifiable)
{
return 'Test message';
}
// App/Controllers/TestController
use App\Notifications\TestNotification
...
public function testMethod()
{
$user = User::first();
$user->notify(new TestNotification());
}
protected function routeNotificationForSharenet()
{
return $this->alternate_field;
}
public function toSharenet($notifiable)
{
return [
'message' => 'Test message',
'sender' => 'Override'
];
}