一直试图从我的 vew 中获取这些代码的输出,但它给我带来了问题,请我真的很乐意寻求帮助。
在我的控制器中
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use App\leaveType;
use App\allLeave;
use App\leaveDepartment;
class LeavesController extends Controller
{
public function getAllLeave()
{
$data = App\allLeave::find(1)->full_name;
return view('leave/allLeave',["data"=>$data]);
}
}
在我的员工模型中
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* Class Personnel
* @package App
*/
class Employee extends Audit
{
public function leave()
{
return $this->belongsTo('App\allLeave');
}
}
在所有离开模型
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class allLeave extends Model
{
public function empolyee()
{
return $this->hasMany('App\Employee');
}
}
在刀片
{{$data->employee->full_name}}
潇潇雨雨
千万里不及你
DIEA