- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
FROM php:7.0.4-fpm | |
RUN apt-get update && apt-get install -y libmcrypt-dev \ | |
mysql-client libmagickwand-dev --no-install-recommends \ | |
&& pecl install imagick \ | |
&& docker-php-ext-enable imagick \ | |
&& docker-php-ext-install mcrypt pdo_mysql |
<?php | |
namespace App\Jobs; | |
use App\Entities\Review; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Queue\SerializesModels; | |
use Illuminate\Queue\InteractsWithQueue; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Foundation\Bus\Dispatchable; |
//SearchController.php | |
public function autocomplete(){ | |
$term = Input::get('term'); | |
$results = array(); | |
$queries = DB::table('users') | |
->where('first_name', 'LIKE', '%'.$term.'%') | |
->orWhere('last_name', 'LIKE', '%'.$term.'%') | |
->take(5)->get(); |
Keep in mind that this implementation requires an api for fetching data, and assumes the following response schema:
{
"perPageOptions": [
15, 50, 100
],
"actions": [
"Delete all", "Publish All", "Unpublish All"
],