本文介绍了如何根据表格在laravel和页面限制中创建表之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
How can i make a relationship between two table in laravel .one table is called defaulters tables that contain all those people that have debts and the other one is called users that have those people that has access to the system.i want to relate these two tables.i have a field called debtors in users table and another called debtors in defaulters table i want those people that have debts not to access some pages when the login and those that have no debts to access those pages .how can i achieve this .please someone help me i stuck.
我尝试了什么:
What I have tried:
below is my debtors.php middleware and is working fine
public function handle($request, Closure $next)
{
if(auth()->user()->debtor == 0){
return redirect('home')->with('success','You can apply for the
Service. You have 0 Debt Balance ');
return $next($request);
}
return redirect('home')->with('error','You can not apply for the
Service , You have 567 Debt Balance ');
}
this my web.php
//user roles
Route::get('/home1', 'HomeController@admin')->middleware('debtors');
Route::get('/application_dashboard', 'HomeController@application_dashboard')->middleware('debtors');'
推荐答案
这篇关于如何根据表格在laravel和页面限制中创建表之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!