私はlaravel 5.3アプリを持っていると私は新しい記事のページを持っていますと、コントローラでSELECT2 https://select2.github.io/
Selectセレクトとlaravel 5.3フォーム
タグモデル
<?php
namespace App\Models;
use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class tag
* @package App\Models
* @version September 20, 2016, 5:31 am UTC
*/
class tag extends Model
{
use SoftDeletes;
public $table = 'tags';
protected $dates = ['deleted_at'];
public $fillable = [
'name',
'id'
];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'name' => 'string'
];
/**
* Validation rules
*
* @var array
*/
public static $rules = [
];
public function post()
{
return $this->belongsTo('App\Models\Post');
}
public function movie()
{
return $this->belongsTo('App\Models\Movies');
}
}
を使用して
<div class="form-group col-sm-12">
<label for="tags"> Select Tags</label>
<select class="custom-select form-control" name="tags" id="tag-select" multiple="multiple">
@foreach($tags as $tag)
<option value="{{$tag->id}}">{{$tag->name}} </option>
@endforeach
</select>
</div>
私は私はクリックした最後のタグの値を取得します。
すべての値を渡す入力を取得し、コントローラで取得する方法を教えてください。
他に必要なことは教えてください。
おかげ
私は[OK]を – Nour