********************************************************************
Plans Modifications for Foodtiger
Author: https://www.reddit.com/user/therealparad0x0n
Publish Date: 16 Dec. 2021
Notice:
Just Finances and Coupons is working, Expenses and Staff need an update
********************************************************************
Add to plan database
`enable_expenses` int(1) NOT NULL DEFAULT 0,
`enable_staff` int(1) NOT NULL DEFAULT 0,
`enable_coupons` int(1) NOT NULL DEFAULT 0,
`enable_finances` int(1) NOT NULL DEFAULT 0,
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../app/Http/Controllers/PlansController.php
Search for function "function store" and replace the function with this one
public function store(Request $request)
{
$this->adminOnly();
//Validate request
$rules=[
'name'=>['required'],
'price'=>['numeric','required'],
'description'=>['required'],
'features'=>['required'],
'stripe_id'=>['sometimes'],
'limit_items'=>['numeric','required'],
'limit_orders'=>['numeric','required']
];
$request->validate($rules);
$plan = new Plans;
$plan->name = strip_tags($request->name);
$plan->price = strip_tags($request->price);
$plan->limit_items = strip_tags($request->limit_items);
if(isset($request->subscribe)){
foreach ($request->subscribe as $key => $value) {
$plan->$key = strip_tags($value);
}
}
$plan->description = $request->description;
$plan->features = $request->features;
$plan->period = $request->period == 'monthly' ? 1 : 2;
$plan->enable_ordering = $request->ordering == 'enabled' ? 1 : 2;
/* Expenses, Staff, Coupons & Finances Dashboard */
$plan->enable_expenses = $request->enable_expenses == 'enabled' ? 1 : 2;
$plan->enable_staff = $request->enable_staff == 'enabled' ? 1 : 2;
$plan->enable_coupons = $request->enable_coupons == 'enabled' ? 1 : 2;
$plan->enable_finances = $request->enable_finances == 'enabled' ? 1 : 2;
/* -- implemented by https://www.reddit.com/user/therealparad0x0n ---- */
$plan->limit_orders = $request->ordering == 'enabled'?$request->limit_orders:0;
$plan->save();
return redirect()->route('plans.index')->withStatus(__('Plan successfully created!'));
}
Search the function "function update" and replace the function with this one
public function update(Request $request, Plans $plan)
{
$this->adminOnly();
$plan->name = strip_tags($request->name);
$plan->price = strip_tags($request->price);
$plan->limit_items = strip_tags($request->limit_items);
//Subscriptions plans
if(isset($request->subscribe)){
foreach ($request->subscribe as $key => $value) {
$plan->$key = strip_tags($value);
}
}
//Default stripe
if(isset($request->stripe_id)){
$plan->stripe_id=$request->stripe_id;
}
$plan->period = $request->period == 'monthly' ? 1 : 2;
$plan->enable_ordering = $request->ordering == 'enabled' ? 1 : 2;
/* Expenses, Staff, Coupons & Finances Dashboard */
$plan->enable_expenses = $request->enable_expenses == 'enabled' ? 1 : 2;
$plan->enable_staff = $request->enable_staff == 'enabled' ? 1 : 2;
$plan->enable_coupons = $request->enable_coupons == 'enabled' ? 1 : 2;
$plan->enable_finances = $request->enable_finances == 'enabled' ? 1 : 2;
/* -- implemented by https://www.reddit.com/user/therealparad0x0n ---- */
$plan->limit_orders = $request->ordering == 'enabled'?$request->limit_orders:0;
$plan->description = $request->description;
$plan->features = $request->features;
$plan->update();
return redirect()->route('plans.index')->withStatus(__('Plan successfully updated!'));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../resources/views/plans/index.blade.php
Search for "@if(count($plans))" (there are 2 results, take the first one) and replace it with this one
@if(count($plans))
<div class="table-responsive">
<table class="table align-items-center table-flush">
<thead class="thead-light">
<tr>
<th scope="col">{{ __('Name') }}</th>
<th scope="col">{{ __('Price') }}</th>
<th scope="col">{{ __('Period') }}</th>
<th scope="col">{{ __('Items limit') }}</th>
<th scope="col">{{ __('Ordering') }}</th>
<!-- Expenses, Staff, Coupons & Finances Dashboard -->
<th scope="col">{{ __('Expenses') }}</th>
<th scope="col">{{ __('Staff') }}</th>
<th scope="col">{{ __('Coupons') }}</th>
<th scope="col">{{ __('Finances') }}</th>
<!---- implemented by https://www.reddit.com/user/therealparad0x0n ------>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach ($plans as $plan)
<tr>
<td><a href="{{ route('plans.edit', $plan) }}">{{ $plan->name }} </a></td>
<td>{{ $plan->price }}</td>
<td>{{ $plan->period == 1 ? __("Monthly") : __("Anually") }}</td>
<td>{{ $plan->limit_items == 0 ? __("Unlimited") : $plan->limit_items }}</td>
<!-- Updatet from text to icon -->
<td>@if($plan->enable_ordering == 1)<i class="ni ni-check-bold"></i>@else<i class="ni ni-fat-remove"></i>@endif</td>
<!-- Expenses, Staff, Coupons & Finances Dashboard -->
<td>@if($plan->enable_expenses == 1)<i class="ni ni-check-bold"></i>@else<i class="ni ni-fat-remove"></i>@endif</td>
<td>@if($plan->enable_staff == 1)<i class="ni ni-check-bold"></i>@else<i class="ni ni-fat-remove"></i>@endif</td>
<td>@if($plan->enable_coupons == 1)<i class="ni ni-check-bold"></i>@else<i class="ni ni-fat-remove"></i>@endif</td>
<td>@if($plan->enable_finances == 1)<i class="ni ni-check-bold"></i>@else<i class="ni ni-fat-remove"></i>@endif</td>
<!---- implemented by https://www.reddit.com/user/therealparad0x0n ------>
<td class="text-right">
<div class="dropdown">
<a class="btn btn-sm btn-icon-only text-light" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v"></i>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<form action="{{ route('plans.destroy', $plan) }}" method="post">
@csrf
@method('delete')
<a class="dropdown-item" href="{{ route('plans.edit', $plan) }}">{{ __('Edit') }}</a>
<button type="button" class="dropdown-item" onclick="confirm('{{ __("Are you sure you want to delete this plan?") }}') ? this.parentElement.submit() : ''">
{{ __('Delete') }}
</button>
</form>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../resources/views/plans/info.blade.php
replace your current "info.blade.php" with this one, or add just my code
<div class="row mb-4 mt--3">
<div class="col-md-12">
<div class="card bg-secondary shadow">
<div class="card-header border-0">
<div class="row align-items-center">
<div class="col-8">
<h3 class="mb-0">{{ __('Your current plan') }}</h3>
</div>
</div>
</div>
<div class="card-body">
<div class="row">
<!-- Status -->
@if(strlen(auth()->user()->plan_status)>0)
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-notification-70 text-red"></i> {{ __('Information') }}</h3>
<p><strong>{{ __(auth()->user()->plan_status) }}</strong><p>
</div>
</div>
</div>
@endif
<!-- Orders -->
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-cart text-red"></i> {{ __('Orders') }}</h3>
<p class="card-text">{{ $planAttribute['ordersMessage'] }}</p>
</div>
</div>
</div>
<!-- Items -->
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-app text-orange"></i> {{ __('Items') }}</h3>
<p class="card-text">{{ $planAttribute['itemsMessage'] }}</p>
</div>
</div>
</div>
<!-- Expenses -->
<div class="col-sm-3">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-money-coins text-red"></i> {{ __('Expenses') }}</h3>
<p class="card-text">{{ $planAttribute['expensesMessage'] }}</p>
</div>
</div>
</div>
<!-- Staff -->
<div class="col-sm-3">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-single-02 text-blue"></i> {{ __('Staff') }}</h3>
<p class="card-text">{{ $planAttribute['staffMessage'] }}</p>
</div>
</div>
</div>
<!-- Coupons -->
<div class="col-sm-3">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-tag text-pink"></i> {{ __("Coupons") }}</h3>
<p class="card-text">{{ $planAttribute['couponsMessage'] }}</p>
</div>
</div>
</div>
<!-- Finances -->
<div class="col-sm-3">
<div class="card">
<div class="card-body">
<h3 class="card-title"><i class="ni ni-money-coins text-blue"></i> {{ __("Finances") }}</h3>
<p class="card-text">{{ $planAttribute['financesMessage'] }}</p>
</div>
</div>
</div>
</div>
</div>
@if(!$showLinkToPlans)
@if(strlen(auth()->user()->cancel_url)>5 && ( config('settings.subscription_processor') == "Stripe"))
<div class="card-footer py-4">
<a href="{{ auth()->user()->update_url }}" target="_blank" class="btn btn-warning">{{__('Update subscription')}}</a>
<a href="{{ auth()->user()->cancel_url }}" target="_blank" class="btn btn-danger">{{__('Cancel subscription')}}</a>
</div>
@endif
@if (!(config('settings.subscription_processor') == "Stripe" || config('settings.subscription_processor') == "Local"))
<!-- Payment processor actions -->
@include($subscription_processor.'-subscribe::actions')
@endif
@else
<div class="card-footer py-4 allign-right right">
<a href="{{ route('plans.current') }}" class="btn btn-success">{{__('Go to plans')}}</a>
</div>
@endif
</div>
</div>
</div>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../resources/views/plans/form.blade.php
replace your current "form.blade.php" with this one, or add just my code
<div class="row">
<!-- Name -->
<div class="col-md-6">
@include('partials.input',['name'=>'Name','id'=>"name",'placeholder'=>"Plan name",'required'=>true,'value'=>(isset($plan)?$plan->name:null)])
</div>
<!-- Price -->
<div class="col-md-6">
@include('partials.input',['type'=>'number','name'=>'Price','id'=>"price",'placeholder'=>"Plan prce",'required'=>true,'value'=>(isset($plan)?$plan->price:null)])
</div>
</div>
<div class="row">
<!-- Description -->
<div class="col-md-12">
@include('partials.input',['name'=>'Plan description','id'=>"description",'placeholder'=>"Plan description...",'required'=>false,'value'=>(isset($plan)?$plan->description:null)])
</div>
<!-- Features -->
<div class="col-md-12">
@include('partials.input',['name'=>'Features list (separate features with comma)','id'=>"features",'placeholder'=>"Plan Features comma separated...",'required'=>false,'value'=>(isset($plan)?$plan->features:null)])
</div>
</div>
<div class="row">
<!-- Items -->
<div class="col-md-6">
@include('partials.input',['type'=>"number", 'name'=>'Items limit','id'=>"limit_items",'placeholder'=>"Number of items",'required'=>false,'additionalInfo'=>"0 is unlimited numbers of items",'value'=>(isset($plan)?$plan->limit_items:null)])
</div>
<!-- Orderings in period -->
<div class="col-md-6">
@include('partials.input',['type'=>"number", 'name'=>'Orders limit per plan period','id'=>"limit_orders",'placeholder'=>"Number of orders per period",'required'=>false,'additionalInfo'=>"0 is unlimited numbers of orders per period",'value'=>(isset($plan)?$plan->limit_orders:null)])
</div>
</div>
<div class="row">
<!-- Stripe -->
@if(config('settings.subscription_processor')=='Stripe')
<div class="col-md-12">
@include('partials.input',['name'=>'Stripe Pricing Plan ID','id'=>"stripe_id",'placeholder'=>"Product price plan id from Stripe starting with price_xxxxxx",'required'=>false,'value'=>(isset($plan)?$plan->stripe_id:null)])
</div>
@else
@if(strtolower(config('settings.subscription_processor'))!='local')
@include($theSelectedProcessor."-subscribe::planid")
@endif
@endif
</div>
<div class="row">
<!-- Period -->
<div class="col-md-2">
<label class="form-control-label"><i class="ni ni-time-alarm text-green"></i> {{ __("Plan period") }}</label>
<div class="custom-control custom-radio mb-3">
<input name="period" class="custom-control-input" id="monthly" @if (isset($plan)) @if ($plan->period == 1) checked @endif @else checked @endif value="monthly" type="radio">
<label class="custom-control-label" for="monthly">{{ __('Monthly') }}</label>
</div>
<div class="custom-control custom-radio mb-3">
<input name="period" class="custom-control-input" id="anually" value="anually" @if (isset($plan) && $plan->period == 2) checked @endif type="radio">
<label class="custom-control-label" for="anually">{{ __('Anually') }}</label>
</div>
</div>
<!-- Ordering-->
<div class="col-md-2">
<label class="form-control-label"><i class="ni ni-basket text-orange"></i> {{ __("Ordering") }}</label>
<div class="custom-control custom-radio mb-3">
<input name="ordering" class="custom-control-input" id="enabled" value="enabled" @if (isset($plan)) @if ($plan->enable_ordering == 1) checked @endif @else checked @endif type="radio">
<label class="custom-control-label" for="enabled">{{ __('Enabled') }}</label>
</div>
<div class="custom-control custom-radio mb-3">
<input name="ordering" class="custom-control-input" id="disabled" value="disabled" @if (isset($plan) && $plan->enable_ordering == 2) checked @endif type="radio">
<label class="custom-control-label" for="disabled">{{ __('Disabled') }}</label>
</div>
</div>
<!-- Expenses, Staff, Coupons & Finances Dashboard -->
<!-- Expenses-->
<div class="col-md-2">
<label class="form-control-label"><i class="ni ni-money-coins text-red"></i> {{ __("Expenses") }}</label>
<div class="custom-control custom-radio mb-3">
<input name="enable_expenses" class="custom-control-input" id="enabled_expenses" value="enabled" @if (isset($plan)) @if ($plan->enable_expenses == 1) checked @endif @else checked @endif type="radio">
<label class="custom-control-label" for="enabled_expenses">{{ __('Enabled') }}</label>
</div>
<div class="custom-control custom-radio mb-3">
<input name="enable_expenses" class="custom-control-input" id="disabled_expenses" value="disabled" @if (isset($plan) && $plan->enable_expenses == 2) checked @endif type="radio">
<label class="custom-control-label" for="disabled_expenses">{{ __('Disabled') }}</label>
</div>
</div>
<!-- Staff-->
<div class="col-md-2">
<label class="form-control-label"><i class="ni ni-single-02 text-blue"></i> {{ __("Staff") }}</label>
<div class="custom-control custom-radio mb-3">
<input name="enable_staff" class="custom-control-input" id="enabled_staff" value="enabled" @if (isset($plan)) @if ($plan->enable_staff == 1) checked @endif @else checked @endif type="radio">
<label class="custom-control-label" for="enabled_staff">{{ __('Enabled') }}</label>
</div>
<div class="custom-control custom-radio mb-3">
<input name="enable_staff" class="custom-control-input" id="disabled_staff" value="disabled" @if (isset($plan) && $plan->enable_staff == 2) checked @endif type="radio">
<label class="custom-control-label" for="disabled_staff">{{ __('Disabled') }}</label>
</div>
</div>
<!-- Coupons-->
<div class="col-md-2">
<label class="form-control-label"><i class="ni ni-tag text-pink"></i> {{ __("Coupons") }}</label>
<div class="custom-control custom-radio mb-3">
<input name="enable_coupons" class="custom-control-input" id="enabled_coupons" value="enabled" @if (isset($plan)) @if ($plan->enable_coupons == 1) checked @endif @else checked @endif type="radio">
<label class="custom-control-label" for="enabled_coupons">{{ __('Enabled') }}</label>
</div>
<div class="custom-control custom-radio mb-3">
<input name="enable_coupons" class="custom-control-input" id="disabled_coupons" value="disabled" @if (isset($plan) && $plan->enable_coupons == 2) checked @endif type="radio">
<label class="custom-control-label" for="disabled_coupons">{{ __('Disabled') }}</label>
</div>
</div>
<!-- Finances-->
<div class="col-md-2">
<label class="form-control-label"><i class="ni ni-money-coins text-blue"></i> {{ __("Finances") }}</label>
<div class="custom-control custom-radio mb-3">
<input name="enable_finances" class="custom-control-input" id="enabled_finances" value="enabled" @if (isset($plan)) @if ($plan->enable_finances == 1) checked @endif @else checked @endif type="radio">
<label class="custom-control-label" for="enabled_finances">{{ __('Enabled') }}</label>
</div>
<div class="custom-control custom-radio mb-3">
<input name="enable_finances" class="custom-control-input" id="disabled_finances" value="disabled" @if (isset($plan) && $plan->enable_finances == 2) checked @endif type="radio">
<label class="custom-control-label" for="disabled_finances">{{ __('Disabled') }}</label>
</div>
</div>
<!-- implemented by https://www.reddit.com/user/therealparad0x0n ------>
</div>
<div class="text-center">
<button type="submit" class="btn btn-success mt-4">{{ isset($plan)?__('Update plan'):__('SAVE') }}</button>
</div>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../resources/views/layouts/navbars/menus/owner.blade.php
Search for the Finances & Coupons block and replace them with this one
<!-- Expenses, Staff, Coupons & Finances Dashboard -->
<!-- Finances -->
@if(config('app.ordering') && config('settings.enable_finances_owner') && (auth()->user()->restorant->getPlanAttribute()['canUseFinancesModule']))
<li class="nav-item">
<a class="nav-link" href="{{ route('finances.owner') }}">
<i class="ni ni-money-coins text-blue"></i> {{ __('Finances') }}
</a>
</li>
@endif
<!-- Coupons -->
@if ( in_array("coupons", config('global.modules',[])) && (auth()->user()->restorant->getPlanAttribute()['canUseCouponsModule']))
<li class="nav-item">
<a class="nav-link" href="{{ route('admin.restaurant.coupons.index') }}">
<i class="ni ni-tag text-pink"></i> {{ __('Coupons') }}
</a>
</li>
@endif
<!-- implemented by https://www.reddit.com/user/therealparad0x0n -->
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../app/Restorant.php
Search for "function getPlanAttribute" (should be line 45) and replace the function block with this
public function getPlanAttribute(){
$planInfo=[
'plan'=>null,
"canMakeNewOrder"=>false,
"canAddNewItems"=>false,
/* Expenses, Staff, Coupons & Finances Dashboard */
"canUseExpensesModule"=>false,
"expensesMessage"=>"",
"canUseStaffModule"=>false,
"staffMessage"=>"",
"canUseCouponsModule"=>false,
"couponsMessage"=>"",
"canUseFinancesModule"=>false,
"financesMessage"=>"",
/* -- implemented by https://www.reddit.com/user/therealparad0x0n ---- */
"itemsMessage"=>"",
"itemsAlertType"=>"success",
"ordersMessage"=>"",
"ordersAlertType"=>"success"
];
//Find the plan
$currentPlan = Plans::withTrashed()->find($this->user->mplanid());
if($currentPlan==null){
//Make artificial plan - usefull when migrating the system - or wrong free plan id
$currentPlan=new Plans();
$currentPlan->name =__('No plan found');
$currentPlan->price = 0;
$currentPlan->limit_items = 0;
$currentPlan->enable_ordering = 1;
/* Expenses, Staff, Coupons & Finances Dashboard */
$currentPlan->enable_expenses = 0;
$currentPlan->enable_staff = 0;
$currentPlan->enable_coupons = 0;
$currentPlan->enable_finances = 0;
/* -- implemented by https://www.reddit.com/user/therealparad0x0n ---- */
$currentPlan->limit_orders = 0;
$currentPlan->period=1;
}
$planInfo['plan']=$currentPlan->toArray();
//Items messages updatet
$itemsCount = Items::whereIn('category_id', $this->categories->pluck('id')->toArray())->whereNull('deleted_at')->count();
if ($currentPlan->limit_items != 0) {
$allowedNewItems=$currentPlan->limit_items - $itemsCount;
$planInfo['canAddNewItems']=$allowedNewItems > 0;
if($allowedNewItems > 0){
$planInfo['itemsMessage']=__('You´ve already created')." ".$currentPlan->limit_items-$allowedNewItems." ".__('of')." ".$currentPlan->limit_items." ".__('allowed items in this plan.')." ".__('If you need more items you have to subscribe a new plan');
if($allowedNewItems < 10){
$planInfo['itemsAlertType']="warning";
}
}
if($allowedNewItems < 1){
$planInfo['itemsMessage']=__('You can not add more items. Please subscribe to new plan.');
$planInfo['itemsAlertType']="danger";
}
}else{
//Unlimited items
$planInfo['itemsMessage']=__('You can add unlimited number of items');
$planInfo['canAddNewItems']=true;
}
//Count orders
//Period
if($currentPlan->period==1){
//Monthly - get start of month
$period=Carbon::now()->startOfMonth();
}else{
//Yearly - get start iof year
$period=Carbon::now()->startOfYear();
}
$orderCount=$this->orders->where('created_at','>=',$period)->count();
if ($currentPlan->limit_orders != 0 && $currentPlan->enable_ordering==1) {
$allowedNewOrders=$currentPlan->limit_orders - $orderCount;
$planInfo['canMakeNewOrder']=$allowedNewOrders > 0;
if($allowedNewOrders > 0){
$planInfo['ordersMessage']=__('You received')." ".$currentPlan->limit_orders-$allowedNewOrders." ".__('of')." ".$currentPlan->limit_orders." ".__('orders').", ".__('which means that you can still receive')." ".$allowedNewOrders." ".__('orders in your plan period');
if($allowedNewOrders < 20){
$planInfo['ordersAlertType']="warning";
}
}
if($allowedNewOrders < 1){
$planInfo['ordersMessage']=__('You can not receive more orders. Please subscribe to new plan.');
$planInfo['ordersAlertType']="danger";
}
}else{
//Unlimited orders - if plan has ordering
if($currentPlan->enable_ordering==1){
//Has ordering
$planInfo['ordersMessage']=__('You can receive unlimited number of orders');
$planInfo['canMakeNewOrder']=true;
}else{
//Doesn't have ordering
$planInfo['ordersMessage']=__('This plan does not allow ordering.');
$planInfo['canMakeNewOrder']=false;
$planInfo['ordersAlertType']="danger";
}
}
/* Expenses, Staff, Coupons & Finances Dashboard */
if($currentPlan->enable_expenses==1){
$planInfo['expensesMessage']=__('You can use the expenses module. For informations visit our library!');
$planInfo['canUseExpensesModule']=true;
}else{
$planInfo['expensesMessage']=__('In this plan, you don´t have access to the expenses module');
$planInfo['canUseExpensesModule']=false;
}
if($currentPlan->enable_staff==1){
$planInfo['staffMessage']=__('You can use the staff module. For informations visit our library!');
$planInfo['canUseStaffModule']=true;
}else{
$planInfo['staffMessage']=__('In this plan, you don´t have access to the staff');
$planInfo['canUseStaffModule']=false;
}
if($currentPlan->enable_coupons==1){
$planInfo['couponsMessage']=__('You can use the coupons module. For informations visit our library!');
$planInfo['canUseCouponsModule']=true;
}else{
$planInfo['couponsMessage']=__('In this plan, you don´t have access to the coupons module');
$planInfo['canUseCouponsModule']=false;
}
if($currentPlan->enable_finances==1){
$planInfo['financesMessage']=__('You can use the finances module. For informations visit our library!');
$planInfo['canUseFinancesModule']=true;
}else{
$planInfo['financesMessage']=__('In this plan, you don´t have access to the finances module');
$planInfo['canUseFinancesModule']=false;
}
/* -- implemented by https://www.reddit.com/user/therealparad0x0n ---- */
return $planInfo;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
../modules/Expenses/Http/Controllers/CategoriesController.php
../modules/Expenses/Http/Controllers/ExpensesController.php
../modules/Expenses/Http/Controllers/VendorsController.php
Add "use App\Restorant;" to the head (as example above "use App\Tables;")
Also Replace the function (in all of the 3 controller files!!!) "function authChecker" with the following
private function authChecker()
{
if (! auth()->user()->hasRole('owner') || !(auth()->user()->restorant->getPlanAttribute()['canUseExpensesModule']) ) {
abort(403, 'Unauthorized action.');
}
}