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
@linkimfly
linkimfly / phpresult.txt
Last active June 1, 2019 13:02
The effect you want
desc:
In addition, if the current time is less than 30 minutes from endhour, expired is also counted as expired.
Array
(
[0] => Array
(
[date] => 2019-06-01
[week] => Saturday
[subdate] => 06-01
@BenQoder
BenQoder / Laravel Homestead SSL
Created July 26, 2018 11:49
This Is The Step I Follow To Make My Laravel Projects Have SSL Certificates Locally
vagrant up && vagrant ssh
cp /etc/nginx/ssl/ca.homestead.homestead.crt /home/vagrant/{Projects Folder}
On Mac, Open terminal and cd into Projects Folder then
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca.homestead.homestead.crt
On Windows, Import certificate as trusted into chrome or preferred browser
<?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')
];
@calebporzio
calebporzio / RouteDirectives.php
Created January 4, 2020 10:33
Blade Route Directives
<?php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
});
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";
@tanthammar
tanthammar / keep-csrf-alive.blade.php
Last active June 23, 2020 08:45
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>
@danharper
danharper / a.md
Last active September 2, 2020 17:13
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

@Yentel
Yentel / HttpCode.php
Created January 18, 2018 15:30
PHP Class with all HTTP Status codes (Laravel)
<?php
namespace App\Http;
class HttpCode
{
/*
* HTTP Status Codes & their meaning
* Source: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
* By: Yentel Hollebeke - https://github.com/yentel
@JeffreyWay
JeffreyWay / AppServiceProvider.php
Last active November 6, 2021 11:51
Laracasts Widgets Lesson
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
@adamwathan
adamwathan / 1-add-macros.php
Last active June 11, 2022 19:55
Multiformat Endpoints in Laravel
<?php
namespace App\Providers;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\ServiceProvider;
use App\Http\Middleware\CaptureRequestExtension;
class AppServiceProvider extends ServiceProvider
@joemaller
joemaller / child-filepath.md
Last active June 17, 2022 15:13
Get PHP child Class file paths from inherited parent class methods

Get PHP child Class file paths from inherited parent class methods

While refactoring some code into a reusable PHP Class I hit a brief roadblock where some code expected the [__FILE__ magic constant][file] file path. Since that value always refers to the specific file it's called from, it won't work from a separate Class file because the referenced path would be the parent instead of the child.

The full filepath of a child Class can be inferred from an inherited parent Class method by combining [get_class($this)][get_class] or [get_called_class()][get_called_class] with the [ReflectionClass::getFileName][getfilename] method like this:

// ParentClass.php
class ParentClass
{