1$users = User::where('email', '=', $request->input('email'))->first();
2if ($users === null) {
3 // User does not exist
4} else {
5 // User exits
6}
1use Illuminate\Database\Seeder;
2use Illuminate\Support\Facades\DB;
3
4class UserSeeder extends Seeder
5{
6 public function run()
7 {
8 // check if table is empty before seeding data
9 if(DB::table('users')->count() == 0) {
10 DB::table('users')->insert([
11 [
12 'first_name' => 'John',
13 'last_name' => 'Doe'
14 ]
15 ]);
16 }
17 }
18}