Skip to content

Instantly share code, notes, and snippets.

View lantrinh1999's full-sized avatar
🖐️
Out sick

TRAN DUC LINH lantrinh1999

🖐️
Out sick
  • Hanoi
View GitHub Profile

Combine multiple ajax permission calls into one.

Depending on how larger your tables are, and how large the latency between you and the server, the UI speed increases can be quite dramatic.

Add the following function to astpp/assets/js/module_js/generate_grid.js around line 360

function build_buttons_multi(buttons_arr) {
    var jsonObj = []; //declare object
    if (buttons_arr == "") {
        return jsonObj;
@sdwru
sdwru / CustomWebsocketOneController.php
Created October 18, 2021 17:24 — forked from rahulhaque/CustomWebsocketOneController.php
Ratchet Websocket Server Routing Example Laravel
<?php
namespace App\Http\Controllers;
use Ratchet\ConnectionInterface;
use Ratchet\WebSocket\MessageComponentInterface;
use React\EventLoop\LoopInterface;
use SplObjectStorage;
class CustomWebsocketOneController implements MessageComponentInterface
@lantrinh1999
lantrinh1999 / Custom.txt
Created April 29, 2021 03:20 — forked from mzaman/Custom.txt
Custom data pagination with Laravel 5
<?php namespace App\Http\Controllers;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
class SearchController extends Controller {
public function search()
{
.
@lantrinh1999
lantrinh1999 / AppServiceProvider.php
Last active September 1, 2020 02:38 — forked from reinink/AppServiceProvider.php
Multi-page Vue App in Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Factory as ViewFactory;
class AppServiceProvider extends ServiceProvider
{
@brunocmoraes
brunocmoraes / Category.php
Created August 9, 2020 20:14
Eloquent: Recursive hasMany Relationship with Unlimited Subcategories
<?php
class Category extends Model
{
public function categories()
{
return $this->hasMany(Category::class);
}
public function childrenCategories()
@sdwru
sdwru / Laravel-websockets-on-Laravel-API-backend+Laravel-Echo-on-Vue.js-front-end-on-different-server-domain-using-private-channel.md
Last active December 2, 2024 12:23
Laravel-websockets on Laravel API backend + Laravel Echo on Vue.js front end on different server/domain using private channel.md

These are my notes on how I got all the basics working end to end.

Laravel API backend and Vue.js frontend are 2 different servers on different public IP addresses and different domains. I am using pure Vue.js on the front end. Most instructions assume Laravel Vue.js is being used which is structured slightly different with different file names and directories.

  • Laravel API backend domain name (api.somedomain.com)
  • Vue.js frontend domain name (client.somedomain.com)

No database is needed for any of this to work using sync queue. That is only needed in production if/when you use a database queue.


@rahulhaque
rahulhaque / CustomWebsocketOneController.php
Created June 25, 2020 10:56
Ratchet Websocket Server Routing Example Laravel
<?php
namespace App\Http\Controllers;
use Ratchet\ConnectionInterface;
use Ratchet\WebSocket\MessageComponentInterface;
use React\EventLoop\LoopInterface;
use SplObjectStorage;
class CustomWebsocketOneController implements MessageComponentInterface
@warlock
warlock / Dockerfile
Created June 3, 2020 12:48
Laravel PHP 7.4 Alpine Dockerfile
FROM php:7.4-alpine
# Install dev dependencies
RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
curl-dev \
imagemagick-dev \
libtool \
libxml2-dev \
postgresql-dev \
@igorjs
igorjs / rest-api-response-format.md
Last active July 31, 2025 12:04
REST API response format based on some of the best practices
@reinink
reinink / AppServiceProvider.php
Last active July 27, 2024 08:17
Multi-page Vue App in Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Factory as ViewFactory;
class AppServiceProvider extends ServiceProvider
{