vendredi 13 août 2021

Can you call data from a column in one table to be used in another table in SQL and Laravel?

I have a staff table that contains the details of staff members and there is another table called maintenance where the time they worked needs to be added. I have an empty combo box and I would like to populate that box with the staff from the staff table so that when a selection is made and the hours they worked is entered and the submit button is clicked, it will save as a record in the maintenance table

here is my combo box code:

<div>               
<label>Select technician</label>
<select name="technician" >
<option value="">--Select--</option>
<option value="Old"></option>
<option value="New"></option>
</select>
</div>

here is my model:

class Maintenance extends Model
{
    public $timestamps = false;
    protected $table='maintentance_table';
    protected $primaryKey = 'id';
    protected $dates = ['date'];
    use HasFactory;
}

and in my controller, I have this line of code:

  $energy->technician= $request->input('technician');

Has anyone figured this out?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fZ0SD1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire