I want to make in my app subscription feature, so here I want to make a new post it will automatically send an email to the email who on my list subscription.
well, I'm here already have the data which it contain the subscription emails. (Table name: subs)
here my controller:
public function postAddSave() {
$simpan= array();
$simpan['title']=Request::input('title');
$simpan['stock_room']=Request::input('stock_room');
$simpan['kamar']=Request::input('kamar');
$simpan['mandi']=Request::input('mandi');
$simpan['sex']=Request::input('sex');
$simpan['address']=Request::input('address');
$simpan['description']=Request::input('description');
$facilities = implode(',',Request::get('facilities'));
$simpan['price']=Request::input('price');
$simpan['coordinate']=Request::input('coordinate');
DB::table('data_kos')->insert($simpan);
Session::flash('success', 'Data has been created');
return Redirect::to('home');
}
and here my view :
<form method='post' action='' enctype="multipart/form-data">
<input type="hidden" name="_token" value="">
<div class="box-body">
<div class="box-body">
<div class='form-group col-sm-6'>
<label>Title</label>
<input type='text' class='form-control' name='title' value='' required/>
</div>
<div class='form-group col-sm-2'>
<label>Stock room</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-bed" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="stock_room" required>
</div>
</div>
<div class='form-group col-sm-2'>
<label>Room Used</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-bed" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="kamar" required>
</div>
</div>
<div class='form-group col-sm-2'>
<label>bathroom</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-child" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="mandi" required>
</div>
</div>
<div class='form-group col-sm-5'>
<label>Address</label>
<input type='text' class='form-control' name='address' value='' required/>
</div>
<div class='form-group col-sm-3'>
<label>Price/month</label>
<div class="input-group">
<span class="input-group-addon">Rp.</span>
<input type="text" class="form-control" name="price" required>
</div>
</div>
<div class='form-group col-sm-4'>
<label>Category</label><br>
<input type="radio" name="sex" value="Wanita">Wanita</input>
<input type="radio" name="sex" value="Laki-Laki">Laki-laki</input>
<!-- <input type="radio" name="sex" value="Wanita/Laki-laki">Wanita/Laki-laki</input> -->
</div>
<div class='form-group col-sm-12'>
<label>Description</label>
<textarea class="ckeditor" placeholder="Place some text here" name="description"></textarea>
</div>
<div class='form-group col-sm-12'>
<label>Facilities</label>
<div class="checkbox">
@foreach ($facilities as $rows)
<label>
<input type="checkbox" value="" name="facilities[]">
</label>
@endforeach
</div>
</div>
<div class='form-group col-sm-12'>
<label>Coordinate</label>
<input type='text' class='form-control' name='coordinate' value='' required/>
</div>
<div class='form-group col-sm-12'>
<button type='submit' class='btn btn-primary'><i class='fa fa-save'></i> Simpan</button>
</div>
</div><!-- /.box -->
</form>
NB : list email to i get from table subs
so, have someone help me what improvements do i have to make to the code to achieve my goal?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire