// Clear compiler composer composer dump-autoload
Last active
April 12, 2016 13:08
-
-
Save a7madev/5531335c696b66169fa1 to your computer and use it in GitHub Desktop.
My Snippets
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 | |
// 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() !!} |
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 | |
// 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 |
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 | |
// 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); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment