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
@calebporzio
calebporzio / error_blade_directive.php
Created March 28, 2019 20:34
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@andrii-trush
andrii-trush / ColumnSortable.vue
Created November 6, 2018 22:34
VueJS component for Laravel pagination + column sortable (https://github.com/Kyslik/column-sortable)
<template>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="text-nowrap">
<a href="#" @click.prevent="sortChange('name')">
<span>Name</span>
<i class="fa" :class="getClass('name', 'alpha')"></i>
</a>
@ctf0
ctf0 / -laravel tips.md
Last active October 21, 2023 05:41
laravel tips
  • php assoc array to correct js array of objs
$data = [
    'Users' => 'abc',
    'posts' => 'blabla',
];

collect($data)->map(function ($v, $k) {
 return [
@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
@cesargb
cesargb / LogProcessorServiceProvider.php
Last active April 5, 2023 14:18
Laravel Log Processor
<?php
namespace App\Providers;
use App;
use Monolog\Processor\GitProcessor;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider;
use Monolog\Processor\MemoryUsageProcessor;
@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
@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
@brunogaspar
brunogaspar / macro.md
Last active May 1, 2024 07:24
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@reinink
reinink / AppServiceProvider.php
Created July 20, 2017 17:04
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()
<?php
/**
* Automatically alias Laravel Model's to their base classname.
* Ex: "App\Models\User" now can just be accessed by "User"
*/
if (! function_exists('aliasModels')) {
function aliasModels() {
$finder = new \Symfony\Component\Finder\Finder();
$finder->files()->name('*.php')->in(base_path().'/app');