Answers for "query where laravel"

PHP
7

laravel not in query

DB::table(..)->select(..)->whereNotIn('book_price', [100,200])->get();
Posted by: Guest on September-26-2020
0

laravel chunk select

DB::table('users')->chunk(100, function($users)
{
    foreach ($users as $user)
    {
        //
    }
});
Posted by: Guest on September-20-2020
0

laravel find query

// Retrieve a model by its primary key...
$flight = App\Models\Flight::find(1);

// Retrieve the first model matching the query constraints...
$flight = App\Models\Flight::where('active', 1)->first();

// Shorthand for retrieving the first model matching the query constraints...
$flight = App\Models\Flight::firstWhere('active', 1);
Posted by: Guest on October-08-2020
2

laravel where

$users = DB::table('users')
                ->whereMonth('created_at', '12')
                ->get();
Posted by: Guest on September-14-2020
0

laravel find query

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'my_flights';
}
Posted by: Guest on October-08-2020
0

laravel find query

<?php

$flights = App\Models\Flight::all();

foreach ($flights as $flight) {
    echo $flight->name;
}
Posted by: Guest on October-08-2020

Browse Popular Code Answers by Language