This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function __construct() | |
{ | |
// Apply middleware to only certain routes | |
$this->middleware('auth', ['only' => ['create', 'store', 'edit', 'delete']]); | |
// Or apply middleware to all routes except these | |
$this->middleware('auth', ['except' => ['index', 'show']]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Models\Project; | |
use Illuminate\Http\Request; | |
class ProjectController extends Controller | |
{ | |
public function update(Request $request, Project $project) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
slugify: function(text) { | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class BlogPost extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace SeshSource\Traits; | |
use Illuminate\Support\Str; | |
trait Uuids | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// utils/AuthService.js | |
export default class AuthService { | |
constructor(domain) { | |
this.domain = domain || 'http://localhost:5000' | |
this.fetch = this.fetch.bind(this) | |
this.login = this.login.bind(this) | |
this.getProfile = this.getProfile.bind(this) | |
} | |
login(email, password) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react' | |
import AuthService from './auth' | |
export default function withAuth(AuthComponent) { | |
const Auth = new AuthService('http://localhost:5000') | |
return class Authenticated extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
isLoading: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace SeshSource\Http\Requests; | |
use Illuminate\Foundation\Http\FormRequest; | |
class StoreEvents extends FormRequest | |
{ | |
/** | |
* Determine if the user is authorized to make this request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
// Grabs a specific "root" SASS file that imports all the others | |
// And runs SASS | |
// Then dumps out to the specificed folder, in this case a WP theme | |
gulp.task('sass', function () { | |
return gulp.src('./wp-content/themes/twenty/sass/style.scss') |