Answers for "define table in laravel model"

PHP
4

laravel model tablename

protected $table = 'DomainRelatedSettings';
Posted by: Guest on January-07-2021
0

laravel table in model

public $table = "dpl_user";

protected $fillable = [ 'user_id', 'fname', 'lname', 'email', 'phone', 'msg'];
Posted by: Guest on August-08-2021
6

laravel create or update

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = App\Models\Flight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);
Posted by: Guest on September-27-2020
0

laravel find query

use App\Models\Destination;
use App\Models\Flight;

return Destination::addSelect(['last_flight' => Flight::select('name')
    ->whereColumn('destination_id', 'destinations.id')
    ->orderBy('arrived_at', 'desc')
    ->limit(1)
])->get();
Posted by: Guest on October-08-2020

Code answers related to "define table in laravel model"

Browse Popular Code Answers by Language