Skip to content

Instantly share code, notes, and snippets.

View ManojKiranA's full-sized avatar
🔍
Focusing

Manoj Kiran ManojKiranA

🔍
Focusing
  • Postiefs Technologies Private Limited
  • Coimbatore
View GitHub Profile
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Collective\Html\{FormFacade as Form , HtmlFacade as Html};
class FormMacroServiceProvider extends ServiceProvider
{
/**
//To Get Size of all the Databases
//please Avoid using this it will take very Long time based on the number of databases
$sizeOfAllDataBases = DB::table('information_schema.TABLES')
->select(['TABLE_NAME as TableName','table_rows as TableRows','data_length as DataLength','index_length as IndexLength','TABLE_SCHEMA as DatabaseName'])
->get()
->map(function($eachDatabse){
$dataIndex = $eachDatabse->DataLength + $eachDatabse->IndexLength;
@ManojKiranA
ManojKiranA / JsonTexter.php
Created July 1, 2019 11:51 — forked from sarfraznawaz2005/JsonTexter.php
read and write php array to json file
<?php
/*
Class for reading and writing array data in json format
Author: Sarfraz Ahmed (sarfraznawaz2005@gmail.com)
*/
class JsonTexter
{
protected $file = null;
public function __construct($file)

using the Macro on Builder

will work work on both the Eloquent Builder and also the Query Builder

    use Illuminate\Database\Eloquent\Builder;

    Builder::macro('search', function ( $tableFields, $searchValues, $splitOn = null, $addOwnWildCard = true) {

$tableFields = (array) $tableFields;

<?php
use Illuminate\Database\Query\Builder;
Builder::macro('orderByNulls', function ($column, $direction = 'asc', $nulls = 'last', $bindings = []) {
$column = $this->getGrammar()->wrap($column);
$direction = strtolower($direction) === 'asc' ? 'asc' : 'desc';
$nulls = strtolower($nulls) === 'first' ? 'NULLS FIRST' : 'NULLS LAST';
return $this->orderByRaw("$column $direction $nulls", $bindings);
});
@ManojKiranA
ManojKiranA / AppServiceProvider.php
Created July 17, 2019 07:19 — forked from reinink/AppServiceProvider.php
Eloquent addSubSelect()
<?php
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot()
<template>
<div v-on:paginationModifyPage="changePageNumberToCurrent">
<ul class="pagination">
<li class="page-item">
<a v-if="paginationData.current_page > 1"
class="page-link"
href="javascript:void(0)"
aria-label="Previous"
v-on:click.prevent="changePageNumberToCurrent(paginationData.current_page - 1)"
<?php
class Json
{
private static $line_break = '<br />';
private static $o_tag = '<div style=\'margin-left:20px;\'>';
private static $c_tag = '</div>';
<?php
class JobChunkerJob
{
/**
* Array of the Request Data.
*
* @var array|null
*/
public $arrayOfData = [];
@ManojKiranA
ManojKiranA / logging.php
Created August 26, 2019 12:14
Split your Laravel daily logs by year/month folders
<?php
// ./config/logging.php
return [
/*
|--------------------------------------------------------------------------
| Split your daily logs by year/month folders
|--------------------------------------------------------------------------