Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Harendra Kumar Kanojiya harendra21

🏠
Working from home
View GitHub Profile
View index.html
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="./assets/style.css">
<title>Angular Firbase Crud App</title>
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
View Chat.php
<?php
namespace App;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
class Chat implements MessageComponentInterface
{
protected $clients;
private $activeUsers;
private $activeConnections;
public function __construct()
View index.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Ratchet WebSocket Chat Sample</title>
<link rel="stylesheet" href="./assets/node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./assets/node_modules/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="./assets/css/bootflat.min.css">
<link rel="stylesheet" href="./assets/css/style.css">
</head>
View main.js
var conn = new WebSocket('ws://localhost:8080');
var name;
conn.onopen = function (e) {
console.log("Connec tion established!");
};
function getTime() {
var date = new Date();
return date.toLocaleDateString()
View chat-server.php
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use App\Chat;
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Chat()
View CrudController.php
<?php
namespace App\Http\Controllers;
use App\crud;
use Illuminate\Http\Request;
class CrudController extends Controller
{
/**
View crudModel.php
<?php
namespace App;
use DB;
use Illuminate\Database\Eloquent\Model;
class crud extends Model
{
public function add($data){
View show.blade.php
@include('parts/header')
<div class="row">
<div class="col show table-responsive">
<table class="table table-stripped table-bordered ">
<thead>
<tr>
<th>S.No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
View add.blade.php
@include('parts/header')
<div class="row">
<div class="col">
<form class="form-group form" action="{{ url('/') }}/add-update-record" method ='POST' >
<div class="form-group">
@if (!empty($user) && !empty($user->id))
<input type="hidden" name="userId" value="{{ $user->id }}">
@endif
<label>First Name : </label>
<input type="text" name="fName" class="form-control" id="_fName" @if (!empty($user->first_name)) value="{{ $user->first_name }}" @else value={{old('fName')}} @endif>