php artisan tinker

Solutions on MaxInterview for php artisan tinker by the best coders in the world

showing results for - "php artisan tinker"
Javier
05 Nov 2020
1php artisan tinker
2# Using this AdminUser Class we can save data from command
3>>> $admin = new App\Models\AdminUser
4=> App\Models\AdminUser {#3379}
5>>> $admin->name = 'Admin'
6=> "Admin"
7>>> $admin->email = 'admin@ids.com'
8=> "admin@ids.com"
9>>> $admin->password = Hash::make('manojd123')
10=> "$2y$10$s7IfVxrc48RYUbYwIbOuXOQRKdDZzXb.4RIVQ1P8bWPcxY6s1IPZe"
11>>> $admin->job_title = 'Admin'
12=> "Admin"
13>>> $admin->save()
14=> true
15>>>
Fabian
13 Mar 2018
1// see the count of all users
2App\User::count();
3
4// find a specific user and see their attributes
5App\User::where('username', 'kamelia')->first();
6
7// find the relationships of a user
8$user = App\User::with('posts')->first();
9$user->posts;