InseoHelper.php 1.47 KB
Newer Older
Aan Choesni Herlingga committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<?php

namespace App\Helpers;

use App\Models\Webprofile\Menu;

class InseoHelper
{
    public static function tglbulanindo2($waktu, $tipe = '')
    {
        $menit = substr($waktu, 14, 2);
        $jam = substr($waktu, 11, 2);
        $tgl = substr($waktu, 8, 2);
        $bln = substr($waktu, 5, 2);
        $thn = substr($waktu, 0, 4);
        $bulan = array('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember');
        $idxhari = date('N', strtotime($waktu));

        switch ($tipe) {
            case 1:
                $full = $tgl . ' ' . $bulan[(int) $bln - 1] . ' ' . $thn;
                break;
            case 2:
                $full = $tgl . '/' . $bln . '/' . $thn;
                break;
            default:
                $full = "$tgl " . $bulan[(int) $bln - 1] . " $thn";
        }

        return $full;
    }

    public static function tgl($waktu)
    {
        $tgl = substr($waktu, 8, 2);
        $bln = substr($waktu, 5, 2);
        $thn = substr($waktu, 0, 4);

        $full = $tgl . ' - ' . $bln . ' - ' . $thn;

        return $full;
    }

    public static function maxmenu($lvl, $parentid)
    {
        $hnewmenu = Menu::where('parent', $parentid)->where('level', $lvl)->max('urutan');

        return $hnewmenu;
    }

    public static function jumchild($lvl, $parentid)
    {
        $hnewmenu = Menu::where('parent', $parentid)->where('level', $lvl)->count();

        return $hnewmenu;
    }
}