php artisan tinker code example
Example 1: php artisan tinker
php artisan tinker
>>> $admin = new App\Models\AdminUser
=> App\Models\AdminUser {
>>> $admin->name = 'Admin'
=> "Admin"
>>> $admin->email = '[email protected]'
=> "[email protected]"
>>> $admin->password = Hash::make('manojd123')
=> "$2y$10$s7IfVxrc48RYUbYwIbOuXOQRKdDZzXb.4RIVQ1P8bWPcxY6s1IPZe"
>>> $admin->job_title = 'Admin'
=> "Admin"
>>> $admin->save()
=> true
>>>
Example 2: exposé tinker laravel
App\User::count();
App\User::where('username', 'kamelia')->first();
$user = App\User::with('posts')->first();
$user->posts;