Hi everyone I am creating a form for my laravel project where user have to enter their name, date of birth and passport number to find out the status of their passport(name is optional).Status can be displayed below the form. Also status should display all the status history along with updated date (since a passport can have many status)with the latest one on top.I have created a form but i have no idea where to go from here.My codes are as follows:[Note:I can assign status to passport already]
Search Form
<h4><b>Check your passport status</h4>
<form>
<fieldset class="form-group">
<label>Full Name:</lable>
<input type="text" class="form-control" placeholder="Your Full Name">
</fieldset>
<fieldset class="form-group">
<label>Date of birth:</label>
<input type="date" class="form-control" >
</fieldset>
<fieldset class="form-group">
<label>Passport Number:</lable>
<input type="text" class="form-control" placeholder="Your Passport Number">
</fieldset>
<button type="submit" class="btn btn-primary">Search</button>
</form>
Passport Model
class Passport extends Model
{
protected $fillable=[
'Full_Name',
'Date_of_Birth',
'Passport_Number'
];
public function status()
{
return $this->belongsToMany('App\Statuses',"passport_statuses","passport_id","statuses_id")->withTimestamps();
}
public function latestStatus()
{
return $this->status()->orderBy('passport_statuses.updated_at', 'desc')->first();
}
}
status Model
class Statuses extends Model
{
protected $fillable=[
'Status_Name'
];
public function passport()
{
return $this->belongsToMany('App\Passport')->withTimestamps();
}
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1RGup35
via IFTTT
Aucun commentaire:
Enregistrer un commentaire