Skip to content

Instantly share code, notes, and snippets.

<?php
include_once('lib/test.php');
require_once('functions/alert.php');
if(isset($_SESSION['loggedIn']) && !empty($_SESSION['loggedIn'])){
// redirect to dashboard
header("Location: dashboard.php");
//write logic for admin to be logged in and access this page
//user object, role and if logged in and role is admin add patient
}
<?php session_start();
require_once('functions/alert.php');
require_once('functions/redirect.php');
require_once('functions/token.php');
require_once('functions/user.php');
$errorCount = 0;
$email = $_POST['email'] != "" ? $_POST['email'] : $errorCount++;
@moneya
moneya / Postman POST PUT Requests.txt
Created October 8, 2019 17:53 — forked from ethanstenis/Postman POST PUT Requests.txt
How to make Postman work with POST/PUT requests in Laravel...
To make Postman work with POST/PUT requests...
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header.
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)...
<meta name="csrf-token" content="{{ csrf_token() }}">
** If using jQuery, you can now instruct it to include the token in all request headers.
$.ajaxSetup({
@moneya
moneya / Ajax-Instructions.md
Created May 14, 2019 16:41 — forked from msurguy/Ajax-Instructions.md
Morris bar charts with AJAX (Laravel)

Did I hear you wanted AJAX charts instead of hard coded? You got it.

Follow this guide to integrate bar chart reports into your Laravel application with AJAX. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

@moneya
moneya / Instructions.md
Created May 14, 2019 16:38 — forked from msurguy/Instructions.md
Daily reports in 5 minutes with Laravel and Morris.js

Follow this guide to integrate bar chart reports into your Laravel application. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

First put this into your page that will have the reports (in the Blade view) to include Morris library:

#Blade
<form id="delete-company" action="{{ route('company.destroy', $company->id) }}" method="post">
{{csrf_field()}}
{{method_field('delete')}}
<button type="button" class="btn btn-xs btn-primary" data-toggle="modal" data-target="#agent{{$company->id}}">Edit</button>
<button type="button" class="btn btn-danger btn-xs" onclick="confirmDelete('delete-company')">delete</button>
</form>
@moneya
moneya / bootstrap4.blade.php
Created March 5, 2019 16:32 — forked from the94air/bootstrap4.blade.php
Bootstrap 4 voyager menu template
@php
if (Voyager::translatable($items)) {
$items = $items->load('translations');
}
@endphp
<ul class="navbar-nav ml-auto">
@foreach($items as $item)
@moneya
moneya / key.md
Created January 8, 2019 14:23
FREE IntelliJ IDEA key 2018.2!

READ or DIE

  • put 0.0.0.0 account.jetbrains.com into your hosts file (C:\Windows\System32\drivers\etc\hosts or /etc/hosts)
  • for GayOS macOS read that
  • use the key below
K71U8DBPNE-eyJsaWNlbnNlSWQiOiJLNzFVOERCUE5FIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJSUzAiLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJXUyIsInBhaWRVcFRvIjoiMjAxOS0wNS0wNCJ9LHsiY29kZSI6IlJEIiwicGFpZFVwVG8iOiIyMDE5LTA1LTA0In0seyJjb2RlIjoiUkMiLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJEQyIsInBhaWRVcFRvIjoiMjAxOS0wNS0wNCJ9LHsiY29kZSI6IkRCIiwicGFpZFVwVG8iOiIyMDE5LTA1LTA0In0seyJjb2RlIjoiUk0iLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAxOS0wNS0wNCJ9LHsiY29kZSI6IkFDIiwicGFpZFVwVG8iOiIy
@moneya
moneya / awesm.md
Created February 14, 2018 22:09 — forked from matula/awesm.md
Awesome PHP stuff in one Gist
@moneya
moneya / Handler.php
Created February 14, 2018 10:47 — forked from collegeman/Handler.php
Boilerplated files for Lumen-based WordPress plugins
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;