Skip to content

Instantly share code, notes, and snippets.

View bayareawebpro's full-sized avatar
✔️
Available for Consulting

Dan Alvidrez bayareawebpro

✔️
Available for Consulting
View GitHub Profile
<?php
class DataModel{
// Hold an instance of the class
private static $instance;
private $data;
private function __construct() {
$this->data = array();
}
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="none" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="description" content="admin login">
<title>Admin - {{ Voyager::setting("admin.title") }}</title>
<link rel="stylesheet" href="{{ voyager_asset('css/app.css') }}">
public function buildSchema() {
$sanJose = Schema::place()
->name('First Security Services')
->alternateName('Santa Clara County Office')
->additionalType('LocalBusiness')
->sameAs([
'https://plus.google.com/118059828266473072030/',
@bayareawebpro
bayareawebpro / ModelVuePropsExample.php
Last active November 16, 2017 17:29
Model Vue Props Example
<?php
//Your Model
protected $appends = [
'vue_props',
];
//Props Ancestor Attribute
public function getVuePropsAttribute(){
$props = (object) array();
@bayareawebpro
bayareawebpro / RecursiveCollections.php
Last active November 21, 2017 16:29
Convert Nested Arrays into Collections
<?php
use \Illuminate\Support\Collection;
Collection::macro('recursive', function () {
return $this->map(function ($value) {
if (is_array($value)) {
return collect($value)->recursive();
}
return $value;
});
@bayareawebpro
bayareawebpro / FileStorageModelMutation.php
Last active November 23, 2017 12:39
File Storage Model Mutation
<?php //Model
/**
* Set Logo Attribute
* @return void
*/
function setLogoAttribute($value){
//Delete current file
if(!is_null($this->attributes['logo']) || is_null($value)){
<?php
//Your Model
public function setUploadsAttribute($value){
foreach($value as $fileUpload){
if($fileUpload->isValid()){
$name = str_slug(str_replace('.'.$fileUpload->getClientOriginalExtension(), '', $fileUpload->getClientOriginalName())).'.'.$fileUpload->guessClientExtension();
$file = [
'name' => $name,
Vue.component('google-autocomplete', {
props: [],
data: function() {
return {
autoComplete: null,
place: {}
}
},
template:'<input ref="autoComplete" placeholder="Type address..." type="text" class="form-control" v-on:keydown="keyDown"/>',
mounted: function() {
//Replace Shortcode
$replacement = "[av_textblock size='' font_color='' color=''] Scroll down to view listings from ".$serviceName." in ".$city.", ".$state.". [/av_textblock]";
$post->post_content = preg_replace('%\[av_textblock size=\'[^"]*\' font_color=\'[^"]*\' color=\'[^"]*\']([^[]*)\[/av_textblock]%', $replacement, $post->post_content);
<stript>
/** Import Element UI **/
import ElementUI from 'element-ui';
import locale from 'element-ui/lib/locale/lang/en';
Vue.use(ElementUI, { locale });
/** Init App **/
window.app = new Vue({
el: '#app',
data() {