Answers for "how to call model in laravel"

PHP
2

call model function in controller laravel

$model = new Model;
$model->func();
__________________________________
  or 
Model::func() // this function must be static to call it staticly ..
Posted by: Guest on June-22-2021
1

laravel create on model

$user = User::create([
    'first_name' => 'Taylor',
    'last_name' => 'Otwell',
    'title' => 'Developer',
]);

$user->title = 'Painter';

$user->isDirty(); // true
$user->isDirty('title'); // true
$user->isDirty('first_name'); // false

$user->isClean(); // false
$user->isClean('title'); // false
$user->isClean('first_name'); // true

$user->save();

$user->isDirty(); // false
$user->isClean(); // true
Posted by: Guest on May-04-2020

Code answers related to "how to call model in laravel"

Browse Popular Code Answers by Language