database/seeds/masyarakatSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
    	$level = Level::where(['nama' => 'masyarakat'])->get()[0]->id;
        $dataUser = [
        	"username" => "masyarakat",
        	"password" => Hash::make("masyarakat"),
        	"id_level" => $level
        ];
        User::create($dataUser);
        $id_user = User::where(['username' => 'masyarakat'])->get()[0]->id;
        $dataMasyarakat = [
        	"nama" => "masyarakat",
            "alamat" => "Jl. manggalima No.5",
            "telp" => "08560412340",
        	"id_user" => $id_user,
        	"photo" => "defrindr.png"
        ];
        Masyarakat::create($dataMasyarakat);
    }
public function run ( ) { $ level = Level :: where ( [ 'nama' => 'masyarakat' ] ) -> get ( ) [ 0 ] -> id ; $ dataUser = [ " username " => " masyarakat " , " password " => Hash :: make ( " masyarakat " ) , " id_level " => $ level ] ; User :: create ( $ dataUser ) ; $ id_user = User :: where ( [ 'username' => 'masyarakat' ] ) -> get ( ) [ 0 ] -> id ; $ dataMasyarakat = [ " nama " => " masyarakat " , " alamat " => " Jl. manggalima No.5 " , " telp " => " 08560412340 " , " id_user " => $ id_user , " photo " => " defrindr.png " ] ; Masyarakat :: create ( $ dataMasyarakat ) ; }
Run the database seeds.
Run the database seeds .