有没有办法允许在 laravel-5.4 应用程序的配置文件中插入可翻译的值?
我在config/fox-reports.php
有一个自定义配置文件,我试图设置一个可翻译的配置值,如下所示:
return [
'attrs' => [
'Product' => __('Product Title')
]
]
当我运行php artisan config:cache
时,会生成以下错误:
在Container.php第729行:
Class translator does not exist
答案 0 :(得分:3)
您无法在配置文件中使用Translator
帮助程序,因为它使用 `<!-- DataTables CSS -->
<link href="vendor/datatables-plugins/dataTables.bootstrap.css"
rel="stylesheet">
<!-- DataTables Responsive CSS -->
<link href="vendor/datatables-responsive/dataTables.responsive.css"
rel="stylesheet">
<table class="table table-striped table-bordered table-hover" id="example">
<thead>
<tr>
<th>First Name</th>
<th>Surname</th>
<th>Gender</th>
<th>Birth Date</th>
<th>Address</th>
<th>Nationality</th>
<th>County</th>
<th>Student Type</th>
<th>Class</th>
<th>Operations</th> // DONT USE COLSPAN WHILE USING DATATABLES
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT student_id, first_name, cell_number, middle_name, surname, gender, date_of_birth, address, nationality, county, student_type, class_name
from students
INNER JOIN classes
ON students.class_id = classes.class_id";
if($result = mysqli_query($connection, $query)){
if(mysqli_num_rows($result) > 0){
while ($row = mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo htmlentities($row['first_name']) ?></td>
<td><?php echo htmlentities($row['surname']) ?></td>
<td><?php echo htmlentities($row['gender']) ?></td>
<td><?php echo htmlentities($row['date_of_birth']) ?></td>
<td><?php echo htmlentities($row['address']) ?></td>
<td><?php echo htmlentities($row['nationality']) ?></td>
<td><?php echo htmlentities($row['county'])?></td>
<td><?php echo htmlentities($row['student_type'])?></td>
<td><?php echo htmlentities($row['class_name'])?></td>
<td align="center"><a class="page_anchor" href="edit_student.php?student=<?php echo urlencode($row['student_id']); ?>">Edit</a></td>
<td align="center"><a class="page_anchor" href="create_grades.php?student=<?php echo urlencode($row['student_id']); ?>">Grades</a></td>
<td align="center"><a class="page_anchor" href="student_details.php?student=<?php echo urlencode($row['student_id']); ?>">Details</a></td>
</tr>
<!-- closing the while loop -->
<?php }?>
</tbody>
<!-- closing the if mysqli_num_rows if statement -->
<?php } else { echo "No record found"; }?>
<!-- closing the if $result = mysqli_query($connection, sql) if statement --
>
<?php } else {
die("Database query failed. ". mysqli_error($connection));
} ?>
</table>
<!-- jQuery -->
<script src="vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/datatables/js/jquery.dataTables.min.js"></script>
<script src="vendor/datatables-responsive/dataTables.responsive.js">
</script>
<script>
$(document).ready(function() {
$('#example').DataTable({
responsive: true
});
});
</script> `
类。当大多数服务尚未初始化时,Laravel会在周期的最开始加载配置。