deeplink/common

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Contains All the common Laravel 5.3 Helpers. Including Push Notification Providers for ONESIGNAL, Cloudinary Fileuploader, SocketiO Event Helper and much more

v1.0.2 2017-01-07 16:15 UTC

This package is not auto-updated.

Last update: 2021-07-24 02:13:05 UTC


README

N|Solid

DeepLink is Laravel 5.3 Helper for various common tasks of your application just like.

  • Onesignal PushNotifications
  • Cloudinary File Upload/File Remove
  • Event Broadcasting using SocketiO/Redis.

Installation

DeepLink requires PHP v5.6+ to run.

Install the package

$ composer require deeplink/common 

Add DeepLinkServiceProvider to your providers array inside config/app.php

    \DeepLink\Common\DeepLinkServiceProvider::class

Publish All vendor files

$ php artisan vendor:publish

Add HasMany Relation to your User Model

$ php artisan vendor:publish

use DeepLink Trait in your controller

use DeepLink\Common\Traits\DeepLinkHelper;

class UserController extends Controller
{



....

Provide neccessary config keys inside config/deeplink.php

USAGE

Add Devices to user model.

use DeepLink\Common\Models\Device;
class User extends Authenticatable
{
    /**
     * User has many devices
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function devices()
    {
        return $this->hasMany(Device::class);
    }
}

....

Send Push Notification to user.

use DeepLink\Common\Traits\DeepLinkHelper;

class UserController extends Controller
{

  
    public function notify()
    {
    ....
        $user = User::find(1);
        DeepLinkHelper::notify_user($user,"Message","Title",["foo"=>"bar"]);
    }

....

Upload Files to Cloudinary

use DeepLink\Common\Traits\DeepLinkHelper;

class UserController extends Controller
{

  
    public function upload_file(Request $request)
    {
    ....
    
        if($request->has('image'))
        {
           $data = DeepLinkHelper::upload_file_cloudinary($request->file('image'));
           return $data['secure_url'];
        }
    }

....

Remove File from Cloudinary

use DeepLink\Common\Traits\DeepLinkHelper;

class UserController extends Controller
{

  
    public function delete_file($file_name)
    {
    ....
           $data = DeepLinkHelper::remove_file_cloudinary($file_name);
           return $data;
    }

....

BroadCast Event Directy through Redis and Socket IO

use DeepLink\Common\Traits\DeepLinkHelper;

class UserController extends Controller
{

  
    public function broadcast_event(Request $request)
    {
    ....
           $user = User::find(1);
           DeepLinkHelper::socketio_broadcast($user,"My-Event",["foo"=>"bar"]);
    }

....