Jump to content

Nicho

New Members
  • Posts

    2
  • Joined

  • Last visited

Nicho's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I already try it like this foreach foreach ($request->input('other_emails') as $email){ BookOther::create([ 'booking_id'=>$booking->id, 'user_id'=>$booking->customer_id, 'other_name'=>$request->input('other_name'), 'other_emails'=>$email ]); Mail::to($email)->send(new OthersEmail($isi_email1)); } But the output will be likt this : input : Name : a Email : a@gmail.com Name : b Email : b@gmail.com Output : Name : b Email : a@gmail.com Name : b Email : b@gmail.com
  2. Hello, i'm currently developing a website using laravel. I have added a 3 new columns for bravo_book_others table the columns are other_name, gender, and other_address. I have a case like this : User1 want to buy 4 holiday package for user1 friends, so user1 have to input 3 of user1 friends like this : Gender#1 : male Name#1 : a Email#1 : a@gmail.com Address#1 : a street Gender#2 : female Name#2 : b Email#2 : b@gmail.com Address#2 : b street Gender#3 : male Name#3 : c Email#3 : c@gmail.com Address#3 : c street I already done it with the email in the controller like this : foreach ($request->input('other_emails') as $email){ BookOther::create([ 'booking_id'=>$booking->id, 'user_id'=>$booking->customer_id, 'other_emails'=>$email ]); Mail::to($email)->send(new OthersEmail($isi_email1)); } How can i put the other_name, gender, and other_address and store it into the database?? The Model : class BookOther extends Model { use HasFactory; protected $table = 'bravo_book_others'; protected $fillable = [ 'booking_id', 'user_id', 'gender', 'other_name', 'other_address', 'other_emails' ]; public function booking(){ return $this->belongsTo('Modules\Booking\Models\Booking', 'booking_id', 'id'); } public function user(){ return $this->belongsTo('App\User', 'user_id', 'id'); } } The Controller : foreach ($request->input('other_emails') as $email){ BookOther::create([ 'booking_id'=>$booking->id, 'user_id'=>$booking->customer_id, 'other_emails'=>$email ]); Mail::to($email)->send(new OthersEmail($isi_email1)); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.