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
@ManojKiranA
ManojKiranA / awesm.md
Created July 30, 2020 03:52 — forked from matula/awesm.md
Awesome PHP stuff in one Gist
@ManojKiranA
ManojKiranA / README.md
Created July 30, 2020 03:47 — forked from ulhaq/README.md
Simple Laravel Database Search

This is a simple trait for database searching.

Model

Our model should of course use the Searchable trait. Likewise, we have to declare the model attributes which shall be searchable.

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits\Searchable;
@ManojKiranA
ManojKiranA / TagTrait.php
Created July 30, 2020 03:45 — forked from saniyathossain/TagTrait.php
Trait for A Virtual Field to Laravel Model Collection
<?php
namespace App\Eloquents\Traits;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str;
use ReflectionClass;
/**
* Generates prefixed column along with padded specific model attribute (e.g. model table primary key attribute)
@ManojKiranA
ManojKiranA / DataStructureGenerator.php
Created July 20, 2020 09:01 — forked from saeedvir/DataStructureGenerator.php
Generate data in key/value structure / For ex: for admin panel dashboard
<?php
/**
*
* @author Saeedvir [
* 'email' => '[email protected]',
* 'telegram' => 'https://t.me/PhpWebDeveloper'
* ]
* @usage :
$dataGenerator = new DataStructureGenerator('data', true,true);
$dataGenerator->setData('users', 8);
<?php /** @var Illuminate\View\ComponentAttributeBag $attributes */ ?>
<?php /** @var Illuminate\Support\HtmlString $slot */ ?>
<?php /** @var int $delay */ ?>
<?php /** @var string $callback */ ?>
<div x-data="abortableButton()" x-init="delay = {{ $delay ?? 5000 }}; callback = () => { {{ $callback }} };" class="w-1/2">
<template x-if="!clicked">
<button
type="button"
class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded w-full"
@ManojKiranA
ManojKiranA / keep-csrf-alive.blade.php
Created June 21, 2020 05:15 — forked from tanthammar/keep-csrf-alive.blade.php
Keep livewire form session alive (419)
<script data-turbolinks-eval=false>
function updateToken() {
fetch('/update-csrf')
.then(response => response.text())
.then(csrf => {
document.head.querySelector('meta[name="csrf-token"]').setAttribute('content', csrf)
})
}
setInterval(updateToken, 1000 * 60 * 5)
</script>
@ManojKiranA
ManojKiranA / app.blade.php
Created June 21, 2020 05:01 — forked from tanthammar/session-timeout-alert-after-livewire-scripts.blade.php
Laravel Livewire Turbolinks Blade component to keep session alive
//in the head
<x-session-timeout-alert-head :permanent="false" />
</head>
//after livewire scripts
@livewireScripts
<x-session-timeout-alert-after-livewire-scripts />
</body>
@ManojKiranA
ManojKiranA / AppServiceProvider.php
Created June 16, 2020 12:51 — forked from JeffreyWay/AppServiceProvider.php
Laracasts Widgets Lesson
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
<?php
$spaces = [
'driver' => 's3',
'key' => env('DO_SPACES_KEY'),
'secret' => env('DO_SPACES_SECRET'),
'endpoint' => env('DO_SPACES_ENDPOINT'),
'region' => env('DO_SPACES_REGION'),
'bucket' => env('DO_SPACES_BUCKET')
];
<?php
namespace App\Charts;
use App\Support\Livewire\ChartComponentData;
use ConsoleTVs\Charts\Classes\Chartjs\Chart;
/**
* Class WanSpeedTestsChart
*