Answers for "laravel custom id field"

PHP
1

laravel model id string

class UserVerification extends Model
{
    protected $primaryKey = 'your_key_name'; // or null

    public $incrementing = false;

    // In Laravel 6.0+ make sure to also set $keyType
    protected $keyType = 'string';
}
Posted by: Guest on December-14-2020
-1

laravel create get id

$user = User::create([
    'username' => $data['username'] . ' ' . $data['username2'],
    'mail' => $data['mail'],
    'password' => bcrypt($data['password']),
]);

$userInfo = UserInformation::create([
    'user_id' => $user->id,
    'current_food' => $food,
    'current_level' => $level,
]);
Posted by: Guest on September-03-2020

Code answers related to "laravel custom id field"

Browse Popular Code Answers by Language