I want to use the relationship in the Form::label
and Form::text
, as the Form
has been removed from laravel. I use 'Form' => 'Collective\Html\FormFacade'
instead.
Here is the relation ship in the Order
Model.
<?php namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
class Order extends \Eloquent
{
use SoftDeletes;
public function account_number()
{
return $this->belongsTo('\App\Models\Account_number', 'product_id', 'id');
}
}
And the blade with Form
. The account_number td will show {"id":4,"user_id":52,"account_type":"alipay","account_no":"xxxxxx","account_name":"xxxxxx","phone":"xxxxxx","created_at":"2017-11-15 14:43:51","updated_at":"2017-11-15 14:43:51","deleted_at":null}
{!! Form::model($order, array('files' => true)) !!}
<table border="1">
<tr>
<td>{!! Form::label('out_trade_no', 'out_trade_no: ') !!}</td>
<td>{!! Form::text('out_trade_no')!!}</td>
</tr>
<tr>
<td>{!! Form::label('account_number', 'account_number: ') !!}</td>
<td>{!! Form::text('account_number')!!}</td>
</tr>
</table>
But I want to show account_number each segment seperately, now with a json string.
I have tryed with
<tr>
<td>{!! Form::label('account_number.id', 'account_number: ') !!}</td>
<td>{!! Form::text('account_number.id')!!}</td>
</tr>
or
<tr>
<td>{!! Form::label('account_number->id', 'account_number: ') !!}</td>
<td>{!! Form::text('account_number->id')!!}</td>
</tr>
But both not works, both leave this td empty.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zL5tnI
via IFTTT
Aucun commentaire:
Enregistrer un commentaire