Skip to content

Instantly share code, notes, and snippets.

View Cannonb4ll's full-sized avatar
🏠

Dennis Smink Cannonb4ll

🏠
View GitHub Profile
<?php
function canonical()
{
$route = Route::current();
if (!$route) {
return false;
}
$action = $route->getAction();
if (!$action) {
@Cannonb4ll
Cannonb4ll / GoogleDriveServiceProvider.php
Created April 30, 2018 17:39 — forked from sergomet/GoogleDriveServiceProvider.php
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@Cannonb4ll
Cannonb4ll / Pagination.vue
Created June 4, 2018 06:47
Vue Pagination Laravel
<template>
<ul class="pagination" v-if="data.total > data.per_page">
<li class="page-item pagination-prev-nav" v-if="data.prev_page_url">
<a class="page-link" href="#" aria-label="Previous" @click.prevent="selectPage(--data.current_page)">
<slot name="prev-nav">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</slot>
</a>
</li>
@Cannonb4ll
Cannonb4ll / Description
Last active November 16, 2020 12:03
Laravel Trait Make command
Place the TraitMakeCommand.php file inside App\Console\Commands
Place the trait.stub file inside App\Console\Commands\stubs
@Cannonb4ll
Cannonb4ll / GetSiteScreenshot.php
Created August 27, 2018 11:43
Laravel Get ScreenshotJob
<?php
namespace App\Jobs\Projects;
use App\Models\Project;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@Cannonb4ll
Cannonb4ll / order-pdf.blade.php
Created September 3, 2018 10:01
Laravel DomPDF Invoice Design
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Invoice - #123</title>
<style type="text/css">
@page {
margin: 0px;
}
@Cannonb4ll
Cannonb4ll / ReCaptcha.php
Created November 15, 2018 13:55
ReCaptcha Laravel Google
<?php
namespace App\Validators;
use GuzzleHttp\Client;
class ReCaptcha
{
public function validate($attribute, $value, $parameters, $validator)
{
@Cannonb4ll
Cannonb4ll / mysqldump-ignore-multiple-tables
Created December 29, 2018 14:12 — forked from insytes/mysqldump-ignore-multiple-tables
mysqldump ignore multiple tables
mysqldump -u root -p database --ignore-table=database.table1 --ignore-table=database.table2 > dump.sql
@Cannonb4ll
Cannonb4ll / Pagination.vue
Created May 27, 2019 09:25
VueJS pagination
<template>
<renderless-pagination :data="data" :limit="limit" v-on:pagination-change-page="onPaginationChangePage">
<ul class="pagination" v-if="computed.total > computed.perPage" slot-scope="{ data, limit, computed, prevButtonEvents, nextButtonEvents, pageButtonEvents }">
<li class="page-item pagination-prev-nav" v-if="computed.prevPageUrl">
<a class="page-link" href="#" aria-label="Previous" v-on="prevButtonEvents">
<slot name="prev-nav">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</slot>
</a>
// Inside appserviceprovider:
private function bootPloiSocialite()
{
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
$socialite->extend(
'ploi',
function ($app) use ($socialite) {
$config = $app['config']['services.ploi'];
return $socialite->buildProvider(PloiProvider::class, $config);
}