Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
@vaibhavpandeyvpz
vaibhavpandeyvpz / Example.js
Last active January 7, 2022 23:45
Laravel, Axios & Logout Over AJAX
import React from 'react';
import ReactDOM from 'react-dom';
const handleLogout = () => {
axios.post('/logout')
.then(() => location.href = '/home')
};
function Example() {
return (
@lamalamaMark
lamalamaMark / imagick3.4.4-PHP7.3-forge.sh
Last active September 15, 2019 20:49 — forked from rostockahoi/imagick3.4.3-PHP7.2-forge.sh
Install Imagick 3.4.4 on PHP 7.3 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.4.tgz
tar xvzf imagick-3.4.4.tgz
<?php
// Add "api_token" field to your user model
// https://medium.com/@danielalvidrez/how-to-use-laravels-built-in-token-auth-6b6f6c26d059
// http://laravel.local/api/resources/pages/1?api_token=XXX
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\App;
Route::middleware('auth:api')->get('resources/{resource}/{page?}', function ($resource, $page = 1) {
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Force HTTPS & Allow LetsEncrypt
RewriteCond %{REQUEST_URI} !\.well-known/acme-challenge
RewriteCond %{HTTP:X-Forwarded-Proto} !https
@bayareawebpro
bayareawebpro / NovaTweaks.md
Last active July 24, 2019 16:20
Tips to maximize the working space of the layout.

alt text

Design Tweaks for Base Nova Installation

I like to maximize the working space of a dashboard so here's a few tips to accomplish that with Larave Nova.

Minimize Horizontal and Vertical Padding of Page Layout.

nova/resources/css/app.css

/**
 * Nova CSS Tweaks (add to line 3)
function pushme {
br=`git branch | grep "*"`
git add --all
if (($# > 1)); then
params=''
for i in $*;
do
@calebporzio
calebporzio / pure_html_css_modal.css
Last active February 28, 2022 18:15
The CSS for the pure HTML/CSS modal I tweeted about.
details summary {
cursor: pointer;
outline: none !important;
display: inline-block;
padding: 8px 12px;
padding-top: 10px;
border-radius: 4px;
overflow: hidden;
background: #F09825;
color: white;
@timacdonald
timacdonald / Builder.php
Last active April 19, 2019 23:09
Basic Search
<?php
namespace App\Builders;
use Illuminate\Database\Eloquent\Builder as BaseBuilder;
class Builder extends BaseBuilder
{
public function search($term, $attributes)
{
// Add this to the "boot()" method of your "AppServiceProvider"
<?php
\Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) {
return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : '');
});
@calebporzio
calebporzio / error_blade_directive.php
Created March 28, 2019 20:34
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After: