Skip to content

Instantly share code, notes, and snippets.

View tnylea's full-sized avatar
💻
Hacking away...

Tony Lea tnylea

💻
Hacking away...
View GitHub Profile
@tnylea
tnylea / WordpressImport.php
Last active July 18, 2018 15:19
Wordpress Import for Laravel Voyager Function
//
// WordpressImport Class Built for LaravelVoyager
//
class WordpressImport
{
// store the Wordpress XML
public $wpXML;
public $authors;
@tnylea
tnylea / Post.php
Created April 20, 2017 17:39
Post Model
<?php
class Post extends Model{
protected $appends = ['link', 'next'];
public function getLinkAttribute()
{
return route('single-post', ['category' => $this->category->slug,'slug' => $this->slug]).'/';
}
@tnylea
tnylea / PostController.php
Created April 20, 2017 17:36
Post Controller return
<?php
public function show($slug, $page = null)
{
// GET ALL YOUR POST DATA
// $post = Post::where('slug', '=', $slug)->firstOrFail();
// $data = ...
// Add this peice to the end of your show method for your post
if($request->ajax()){
@tnylea
tnylea / post.blade.php
Created April 20, 2017 17:30
Post partial
<div id="{{ $post->slug }}">
<!-- THE MAIN CONTENT FOR YOUR POST HERE -->
</div>
@tnylea
tnylea / app.js
Created April 20, 2017 17:24
Example of creating a Vue Instance for Post infinite scroll
if(document.getElementById('post')){
window.VueAppPost = new Vue({
el: '#post'
});
}
@tnylea
tnylea / post.blade.php
Created April 20, 2017 17:18
Example of Post View
<div id="post">
@include('partials.post')
<infinite-scroll-post post="{{ $post }}" loader="/path/to/loader.svg"></infinite-scroll-post>
</div>
@tnylea
tnylea / uploadable.sh
Created April 16, 2017 16:56
Change the Laravel File Structure so that way users can easily upload it to any server
#!/bin/sh
# Make our New Application folder
mkdir application
# Loop through all the files in the current directory and move them to the new application folder
# Exclude '.', '..', 'application', and 'uploadable.sh'
for i in `ls -a`;
do
@tnylea
tnylea / script.sh
Created April 11, 2017 20:14
Moving files into a separate folder for Laravel App
root_path="./"
mkdir ${root_path}/application
cp -a ${root_path}/app ${root_path}/application/app
cp -a ${root_path}/bootstrap ${root_path}/application/bootstrap
cp -a ${root_path}/config ${root_path}/application/config
cp -a ${root_path}/database ${root_path}/application/database
cp -a ${root_path}/resources ${root_path}/application/resources
cp -a ${root_path}/storage ${root_path}/application/storage
cp -a ${root_path}/vendor ${root_path}/application/vendor
@tnylea
tnylea / social.php
Created December 6, 2016 18:24
Social Share for Laravel apps
<ul>
<li class="facebook"><a href="https://www.facebook.com/sharer/sharer.php?u=<?= Request::url() ?>" target="_blank" title="Share on Facebook" onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;"><i class="fa fa-facebook"></i></a></li>
<li class="twitter"><a href="https://twitter.com/intent/tweet?url=<?= Request::url() ?>&text=<?= $title ?>" data-url="<?= Request::url() ?>" title="Share on Twitter"><i class="fa fa-twitter" data-url="<?= Request::url() ?>"></i></a></li>
<li class="googleplus"><a href="https://plus.google.com/share?url=<?= Request::url() ?>" target="_blank" title="Share on Google" onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;"><i class="fa fa-google-plus"></i></a></li>
<li class="pinterest"><a href="//www.pinterest.com/pin/create/button/?url=<?= Request::url() ?>&media=<?= $image_url ?>&description=<?= $de
@tnylea
tnylea / app.blade.php
Last active November 5, 2016 18:08
Laravel Master File Head Information
<!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">
<title>@if(isset($seo_title)){{ $seo_title . ' - Site Name' }}@else{{ 'Site Name - Default Site Headline' }}@endif</title>
<!-- only set meta description and keywords if exists -->