Skip to content

Instantly share code, notes, and snippets.

@a7madev
Last active April 12, 2016 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a7madev/5531335c696b66169fa1 to your computer and use it in GitHub Desktop.
Save a7madev/5531335c696b66169fa1 to your computer and use it in GitHub Desktop.
My Snippets
<?php
// Blade if statement
@if()
@elseif()
@else
@endif
// Text Placeholder
{!! $currency !!}
// Form
{!! Form::model($user, ['route' => 'frontend.profile.update', 'class' => 'form-togglable', 'method' => 'PATCH']) !!}
{!! Form::selectCurrency('currency', $currency, ['placeholder' => 'Currency']) !!}
{!! Form::submit(trans('labels.save_button'), ['class' => 'button alert']) !!}
{!! Form::close() !!}

// Clear compiler composer composer dump-autoload

// Pull and merge, take ours git pull -s recursive -X ours

// Pull and merge, take theirs git pull -s recursive -X theirs

// ignore file permission changes git config core.fileMode false

<?php
// make controller
php artisan make:controller ExistingUsersController
// make model
php artisan make:model SampleModel
// make migrate
php artisan make:migration:schema create_categories_table
php artisan make:migration:schema add_categories_to_faqs_table
// migrate
php artisan migrate
// rollback migrate
php artisan migrate:rollback
// clear cache
php artisan cache:clear
<?php
// loop through array, add values to another array
$all_activities = array();
foreach($all_job_applications as $job) {
$all_activities[] = $job;
}
// Carbon relative time
echo \Carbon\Carbon::createFromTimeStamp(strtotime($comment->created_at))->diffForHumans();
// relational where
$posts = Post::whereHas('categories', function($q)
{
$q->where('slug', '=', Input::get('category_slug'));
})->get();
// Elequent where (1 or 2)
Model::where(function ($query) {
$query->where('a', '=', 1)
->orWhere('a', '=', 2);
});

Envoy path on Windows (Add to Env Path)

C:\Users<username>\AppData\Roaming\Composer\vendor\bin

500 Server Error

sudo chmod 755 -R laravel_blog chmod -R o+w laravel_blog/storage

Delete folder (Linux)

rm -R -f directory_name/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment