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
// Here's what my web.php file looks like with a locale prefix on all routes for a multilingual app. | |
// To manage the locale, I'm using two middlewares: | |
// the 'locale.default' middleware to set a default locale, | |
// and the 'locale' middleware to call app()->setLocale($segment) on the first request segment. | |
// The two middlewares appear to be working fine. | |
Route::prefix('{locale?}')->middleware(['locale.default', 'locale'])->group(function() { | |
Route::get('/car/{id}', [ | |
'uses' => 'CarController@getCar', | |
'as' => 'car', |
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
Can't see the confirmation/success messages during the Auth Password Reset process in Laravel 5.2? Here's how to output them in a view. | |
@if( Session::has('status') ) | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="alert alert-success"> | |
<p>{{ Session::get('status') }}</p> | |
</div> | |
</div> | |
</div> |
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 country_dropdown($name, $selected) | |
{ | |
$country_array = array( | |
'AF'=>'Afghanistan', | |
'AL'=>'Albania', | |
'DZ'=>'Algeria', | |
'AS'=>'American Samoa', | |
'AD'=>'Andorra', | |
'AO'=>'Angola', | |
'AI'=>'Anguilla', |
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
//1. Install the package using Composer. Edit your project's composer.json file to require laravelcollective/html. | |
"require": { | |
"laravelcollective/html": "5.2.*" | |
} | |
//2. Run "composer update" from the Terminal | |
//3. Add the new provider to the providers array in the file config/app.php: |
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
add_action( 'edit_form_after_editor', 'my_new_content_areas' ); | |
add_action( 'save_post', 'save_my_new_content_areas', 10, 2 ); | |
function my_new_content_areas() | |
{ | |
global $post; | |
if( 'listings' != $post->post_type ) | |
return; | |
$editor1 = get_post_meta( $post->ID, 'my_new_editor_1', 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
$errors = array(); | |
if(isset($_FILES)) | |
{ | |
foreach($_FILES as $file) | |
{ | |
if($file['error'] == 0) | |
{ | |
$file_type = wp_check_filetype(basename($file['name'])); | |
$uploaded_file_type = $file_type['type']; |
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
/* MONK */ | |
//1. | |
$npm install -—save monk | |
//2. in your route (ex: index.js) | |
var express = require('express'); | |
var router = express.Router(); |
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
//1. Install mongodb package for Express | |
$ sudo npm install —-save mongodb | |
//--save will add mongodb to the Express dependencies in package.json | |
//2. Now to set up MongoDB usage in your router (ex: routes/index.js): | |
var express = require('express'); | |
var router = express.Router(); |
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
//In the terminal, go to your project folder and run the following: | |
$ npm install --save express-validator | |
$ npm install --save express-session | |
//----------------------------------- | |
//Go to your app.js file, and make sure it reads as follows: | |
//----------------------------------- |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Title</title> | |
<meta name="description" content="Description..."> | |
<meta name="author" content="Me"> |
NewerOlder