Skip to content

Instantly share code, notes, and snippets.

View Ghostscypher's full-sized avatar

Brian Ngetich Ghostscypher

View GitHub Profile
<script>
const public_channel = '{{config('app.name')}}.Public';
Echo.channel(public_channel)
.listen('OrderShipmentStatusUpdated', (data) => {
console.log(data)
});
</script>
@logged_in
<?php
use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;
return [
/*
* Set a custom dashboard configuration
*/
'dashboard' => [
server {
listen 80;
server_name ws.example.com;
# For ssl support add correct path here
#ssl_certificate /path/to/www.example.com.cert;
#ssl_certificate_key /path/to/www.example.com.key;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
<?php
namespace App\Traits;
use Illuminate\Cache\FileStore;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Cache;
trait LockEventTrait
{
protected FileStore $file_cache;
<?php
namespace App\Http\Middleware;
use App\Traits\LockEventTrait;
use Closure;
use Illuminate\Http\Request;
class LockRouteMiddleware
{
use LockEventTrait;
/**
@Ghostscypher
Ghostscypher / login.blade.php
Created February 2, 2022 12:08
Oauth2-Server App login blade
@extends('layout.layout')
@section('content')
<form action="{{route('login.post')}}" method="POST">
@csrf
@error('success')
<div class="success">
{{$message}}
</div>
<br><br>
@Ghostscypher
Ghostscypher / register.blade.php
Created February 2, 2022 12:10
Oauth2-Server app register blade file
@extends('layout.layout')
@section('content')
<form action="{{route('register.post')}}" method="POST">
@csrf
@error('success')
<div class="success">
{{$message}}
</div>
@Ghostscypher
Ghostscypher / layout.blade.php
Created February 2, 2022 12:13
Layout blade shared between Oauth2-Server app and the Client app
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
@Ghostscypher
Ghostscypher / AuthController.php
Created February 2, 2022 12:14
Oauth2-Server app AuthController
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class AuthController extends Controller
{
@Ghostscypher
Ghostscypher / web.php
Created February 2, 2022 12:17
Oauth2-Server app web.php
<?php
use App\Http\Controllers\AuthController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|