Skip to content

Instantly share code, notes, and snippets.

Salipro Pham salipro4ever

Block or report user

Report or block salipro4ever

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@salipro4ever
salipro4ever / subdomain-laravel.md
Created May 6, 2019
subdomain map to subdirectory route in existing Laravel
View subdomain-laravel.md

I serve multiple subdomains with Laravel with this code here:

RouteServiceProvider.php

  protected function mapSubdomainRoutes()
  {
    Route::group([
      'namespace' => $this->namespace,
      'domain' => '{subdomain}.affekt.de',
    ], function () {
@salipro4ever
salipro4ever / paginate-laravel-collection.php
Created Dec 8, 2018
You can add this method as Collection method in AppServiceProvider. just add this in boot method.
View paginate-laravel-collection.php
if (!Collection::hasMacro('AppServiceProvider')) {
Collection::macro('paginate',
function ($perPage = 15, $page = null, $options = []) {
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
return (new LengthAwarePaginator(
$this->forPage($page, $perPage), $this->count(), $perPage, $page, $options))
->withPath('');
});
}
@salipro4ever
salipro4ever / paginate.php
Created Dec 8, 2018 — forked from ctf0/paginate.php
Laravel Paginate Collection or Array
View paginate.php
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
*
* @return LengthAwarePaginator
*/
View awesome-laravel-packages.md

pragmarx/version

https://github.com/antonioribeiro/version

This package is a Laravel (5.5+) utility which helps you keep and manage your application version, increment version numbers (major, minor, patch, build), and can also use your last commit hash as build number.

View laravel-notes.md
class ProjectController extends Controller
{
    /**
     * All of the current user's projects.
     */
    protected $projects;

    /**
     * Create a new controller instance.
@salipro4ever
salipro4ever / MyCheckClientCredentials.php
Created Oct 3, 2018
Get client from Client Credentials Grant - Laravel Passport
View MyCheckClientCredentials.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Auth\AuthenticationException;
use League\OAuth2\Server\Exception\OAuthServerException;
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Laravel\Passport\Http\Middleware\CheckClientCredentials;
class MyCheckClientCredentials extends CheckClientCredentials
{
@salipro4ever
salipro4ever / english-inventory.md
Last active Sep 24, 2018
English for Inventory/Stock
View english-inventory.md

Inventory/Stock

Tồn kho, nhưng stock chỉ đơn thuần nói về số lượng tồn không bao gôm giá trị như inventory

Purchase Order

Đơn mua hàng gửi đến nhà cung cấp, bao gồm số lượng, giá cả thoả thuận...

Purchase Return

@salipro4ever
salipro4ever / error-html-string-ajax.md
Last active Apr 10, 2019
Error concat html string in ajax
View error-html-string-ajax.md

must add <\/closetag>

var markup = '<div class="media">'+
   '  <div class="media-left">'+
   '     <img class="media-object" src="'+ thumb +'" style="height:40px; width:40px;">'+
   '  <\/div>'+
   '  <div class="media-body">'+
   '    <div><strong class="media-heading">'+item.name+'</strong><\/div>'+
   '    <strong class="text-red"> '+numeral(item.price).format('0,0')+ '<\/strong>'+
View laravel-note-whereHas-orWhere.md

$results = Stock::whereHas('receiptNotes',function ($query) { $query->where('status', 'approved'); })->where(function ($query) use ($q) { $query->where('name','like',"%$q%")->orWhere('code','like',"%$q%"); })->limit(10)->get();

    #salipro: bug laravel, khong hoat dong neu nhu the nay
        //->where('name','like',"%$q%")
        //->orWhere('code','like',"%$q%")
You can’t perform that action at this time.