laravel tinker code example
Example 1: tinker laravel tutorial
php artisan tinker
$user = new App\User;
$user->name = "Wruce Bayne";
$user->email = "[email protected]";
$user->save();
Example 2: laravel create command tutorial
$arguments = $this->arguments();
Example 3: laravel create command tutorial
if ($this->confirm('Do you wish to continue?')) {
//
}
Example 4: laravel create command tutorial
php artisan email:send 1 --queue
Example 5: exposé tinker laravel
// see the count of all users
App\User::count();
// find a specific user and see their attributes
App\User::where('username', 'kamelia')->first();
// find the relationships of a user
$user = App\User::with('posts')->first();
$user->posts;
Example 6: laravel create command tutorial
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'email:send {user}';