PHP Classes

File: helper/helpers.php

Recommend this page to a friend!
  Classes of Nyi Nyi Lwin   Laravel Video Chat   helper/helpers.php   Download  
File: helper/helpers.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Laravel Video Chat
Multiuser video chat using Socket.IO and WebRTC
Author: By
Last change: Apply fixes from StyleCI
Add File Sharing

Date: 6 years ago
Size: 830 bytes
 

Contents

Class file image Download
<?php
/**
 * Created by PhpStorm.
 * User: nyinyilwin
 * Date: 10/19/17
 * Time: 4:35 AM.
 */
if (!function_exists('check')) {
    function
check()
    {
       
$guards = array_keys(config('auth.guards'));

        foreach (
$guards as $guard) {
            if (
auth()->guard($guard)->check()) {
                return
auth()->guard($guard);
            }
        }
    }
}

if (!
function_exists('human_file_size')) {
    function
human_file_size($bytes, $decimals = 2)
    {
       
$size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'];
       
$factor = floor((strlen($bytes) - 1) / 3);

        return
sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)).@$size[$factor];
    }
}

if (!
function_exists('get_file_details')) {
    function
get_file_details($path)
    {
        return
app('upload.manager')->fileDetails($path);
    }
}