Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel search multiple (related) tables

use IlluminateDatabaseEloquentBuilder;
 
// Retrieve posts with at least one comment containing words like code%...
$posts = Post::whereHas('comments', function (Builder $query) {
    $query->where('content', 'like', 'code%');
})->get();
 
// Retrieve posts with at least ten comments containing words like code%...
$posts = Post::whereHas('comments', function (Builder $query) {
    $query->where('content', 'like', 'code%');
}, '>=', 10)->get();
Comment

PREVIOUS NEXT
Code Example
Php :: php date list 
Php :: how to insert data in table and fetch in wordpress 
Php :: install php unzip 
Php :: IlluminateContractsAuthAuthenticatable, AppModelsUser given, called in 
Php :: job with queue name in laravel 
Php :: laravel one session per user 
Php :: Creating Laravel and Vue Project 
Php :: PHP strtolower — Make a string lowercase 
Php :: laravel model 
Php :: laravel create session table 
Php :: acf sub_field image title 
Php :: symfony messenger rabbitMQ 
Php :: php http method 
Php :: laravel inline if else if 
Php :: php declare array 
Php :: php slice array in half 
Php :: php url variables 
Php :: html in php 
Php :: json encode php 
Php :: php get variable by string name 
Php :: laravel max length format 
Php :: two column date compare in php 
Php :: parse json phph 
Php :: nested with laravel 
Php :: laravel passport Route [login] not defined 
Php :: add phpmyadmin login linux 
Php :: Compiling multiple CSS into ONE CSS with Laravel MIX 
Php :: $ is not define in laravel 
Php :: orderby total sales woocommerce 
Php :: laravel blade array seearch select box 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =