我使用Laravel,在我的控制器我有一個返回建立字符串的函數:返回Laravel刀片語法
public function getAddEditRemoveColumnData()
{
$projects = Project::select(['id', 'name', 'cost', 'created_at']);
return Datatables::of($projects)
->addColumn('action', function ($project) {
return '<div class="btn-group">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a href="/projects/' . $project->id . '/edit">Edit</a></li>
<li>
<a>{!! Form::open(array("url" => "projects/" . $project->id, "class" => "", "id" => "delete-form")) !!}
{!! Form::hidden("_method", "DELETE") !!}
<button type="submit" class="btn-link delete-action" style="color:inherit; text-decoration: none;">Delete</button>
{!! Form::close() !!}
</a>
</li>
</ul>
</div>';
})
->make(true);
}
創建形式刀片語法不被評價爲是被視爲字符串文字。有沒有什麼辦法可以解決這個問題,並得到要解釋的刀片語法{{ }}
?
這工作。乾淨的解決方案!謝謝 – user3574492