From 4785302a517590afdfef57aeb67699ccebd3dd04 Mon Sep 17 00:00:00 2001 From: Ajit Bohra Date: Mon, 14 Jan 2019 00:40:31 +0530 Subject: [PATCH] Refactor and cleanup --- app/ChequeDetail.php | 2 +- app/Expense.php | 2 +- app/ExpenseCategory.php | 2 +- app/Followup.php | 2 +- app/Http/Controllers/AclController.php | 10 +-- .../Controllers/DataMigrationController.php | 5 -- app/Http/Controllers/MembersController.php | 55 +++++++------ app/Http/Controllers/ReportsController.php | 78 ------------------ app/Http/routes.php | 48 +---------- app/Invoice.php | 8 +- app/InvoiceDetail.php | 4 +- app/Member.php | 17 +--- app/PaymentDetail.php | 4 +- app/Permission.php | 2 +- ...Permission_role.php => PermissionRole.php} | 2 +- app/Plan.php | 4 +- app/Role.php | 6 +- app/RoleUser.php | 4 +- app/Service.php | 2 +- app/Subscription.php | 6 +- app/User.php | 2 +- .../dashboard/_index/birthdays.blade.php | 2 +- .../dashboard/_index/bouncedCheques.blade.php | 2 +- .../_index/depositedCheques.blade.php | 2 +- .../views/dashboard/_index/due.blade.php | 2 +- .../dashboard/_index/enquiries.blade.php | 2 +- .../views/dashboard/_index/expired.blade.php | 5 +- .../views/dashboard/_index/expiring.blade.php | 5 +- .../dashboard/_index/outStanding.blade.php | 2 +- .../dashboard/_index/receivedCheque.blade.php | 2 +- .../views/dashboard/_index/recents.blade.php | 5 +- .../dashboard/_index/reminders.blade.php | 2 +- .../views/dashboard/_index/smsLog.blade.php | 2 +- resources/views/dashboard/index.blade.php | 4 - resources/views/invoices/discount.blade.php | 2 +- resources/views/invoices/show.blade.php | 16 ++-- .../views/reports/enquiries/charts.blade.php | 9 --- .../views/reports/enquiries/data.blade.php | 9 --- .../views/reports/expenses/charts.blade.php | 9 --- .../views/reports/expenses/data.blade.php | 9 --- .../views/reports/invoices/charts.blade.php | 9 --- .../views/reports/invoices/data.blade.php | 9 --- .../views/reports/members/charts.blade.php | 9 --- .../views/reports/members/data.blade.php | 80 ------------------- .../views/reports/payments/charts.blade.php | 9 --- .../views/reports/payments/data.blade.php | 9 --- .../reports/subscriptions/charts.blade.php | 9 --- .../reports/subscriptions/data.blade.php | 9 --- resources/views/user/editUser.blade.php | 2 +- resources/views/user/userIndex.blade.php | 2 +- 50 files changed, 95 insertions(+), 408 deletions(-) delete mode 100755 app/Http/Controllers/ReportsController.php rename app/{Permission_role.php => PermissionRole.php} (86%) delete mode 100755 resources/views/reports/enquiries/charts.blade.php delete mode 100755 resources/views/reports/enquiries/data.blade.php delete mode 100755 resources/views/reports/expenses/charts.blade.php delete mode 100755 resources/views/reports/expenses/data.blade.php delete mode 100755 resources/views/reports/invoices/charts.blade.php delete mode 100755 resources/views/reports/invoices/data.blade.php delete mode 100755 resources/views/reports/members/charts.blade.php delete mode 100755 resources/views/reports/members/data.blade.php delete mode 100755 resources/views/reports/payments/charts.blade.php delete mode 100755 resources/views/reports/payments/data.blade.php delete mode 100755 resources/views/reports/subscriptions/charts.blade.php delete mode 100755 resources/views/reports/subscriptions/data.blade.php diff --git a/app/ChequeDetail.php b/app/ChequeDetail.php index d1fe968a..75f38e83 100644 --- a/app/ChequeDetail.php +++ b/app/ChequeDetail.php @@ -31,7 +31,7 @@ public function createdBy() return $this->belongsTo('App\User', 'created_by'); } - public function Payment() + public function payment() { return $this->belongsTo('App\PaymentDetail', 'payment_id'); } diff --git a/app/Expense.php b/app/Expense.php index f112eb75..bac3a61a 100755 --- a/app/Expense.php +++ b/app/Expense.php @@ -33,7 +33,7 @@ class Expense extends Model protected $dates = ['created_at', 'updated_at', 'due_date']; - public function Category() + public function category() { return $this->belongsTo('App\ExpenseCategory', 'category_id'); } diff --git a/app/ExpenseCategory.php b/app/ExpenseCategory.php index 157f5795..e6f3c916 100755 --- a/app/ExpenseCategory.php +++ b/app/ExpenseCategory.php @@ -24,7 +24,7 @@ public function scopeExcludeArchive($query) return $query->where('status', '!=', \constStatus::Archive); } - public function Expenses() + public function expenses() { return $this->hasMany('App\Expense', 'category_id'); } diff --git a/app/Followup.php b/app/Followup.php index 5d9c9414..5271cc6f 100755 --- a/app/Followup.php +++ b/app/Followup.php @@ -23,7 +23,7 @@ class Followup extends Model protected $dates = ['created_at', 'updated_at', 'due_date']; - public function Enquiry() + public function enquiry() { return $this->belongsTo('App\Enquiry', 'enquiry_id'); } diff --git a/app/Http/Controllers/AclController.php b/app/Http/Controllers/AclController.php index 6d8c138b..7692cd80 100755 --- a/app/Http/Controllers/AclController.php +++ b/app/Http/Controllers/AclController.php @@ -8,7 +8,7 @@ use App\User; use App\RoleUser; use App\Permission; -use App\Permission_role; +use App\PermissionRole; use Illuminate\Http\Request; class AclController extends Controller @@ -88,8 +88,8 @@ public function updateUser($id, Request $request) } $user->save(); - if ($user->role_user->role->id != $request->role_id) { - RoleUser::where('user_id', $user->id)->where('role_id', $user->role_user->role_id)->delete(); + if ($user->roleUser->role->id != $request->role_id) { + RoleUser::where('user_id', $user->id)->where('role_id', $user->roleUser->role_id)->delete(); $user->attachRole($request->role_id); } @@ -166,7 +166,7 @@ public function editRole($id) { $role = Role::findOrFail($id); $permissions = Permission::all(); - $permission_role = Permission_role::where('role_id', $id)->get(); + $permission_role = PermissionRole::where('role_id', $id)->get(); return view('user.editRole', compact('role', 'permissions', 'permission_role')); } @@ -184,7 +184,7 @@ public function updateRole($id, Request $request) ]); //Updating permissions for the role - $DBpermissions = Permission_role::where('role_id', $id)->select('permission_id')->lists('permission_id'); + $DBpermissions = PermissionRole::where('role_id', $id)->select('permission_id')->lists('permission_id'); $ClientPermissions = collect($request->permissions); $addPermissions = $ClientPermissions->diff($DBpermissions); diff --git a/app/Http/Controllers/DataMigrationController.php b/app/Http/Controllers/DataMigrationController.php index 6fcc4f7d..9b2200e4 100755 --- a/app/Http/Controllers/DataMigrationController.php +++ b/app/Http/Controllers/DataMigrationController.php @@ -53,7 +53,6 @@ public function migrate() DB::commit(); } catch (\Exception $e) { DB::rollback(); - dd($e); } } @@ -80,7 +79,6 @@ public function migrateMedia() } } catch (\Exception $e) { DB::rollback(); - dd($e); } } @@ -104,7 +102,6 @@ public function migrateExcel() $dob = Carbon::createFromFormat('d/m/Y', $line->get('dob'))->toDateString(); $gender = ($line->get('gender') == 'male' ? 'm' : 'f'); - // $explodedName = explode(" ", $line->get('name')); $email = $member_code.'@evolvegym.in'; $address = (empty($line->get('address')) ? 'Naigaon east' : $line->get('address')); @@ -219,8 +216,6 @@ public function migrateExcel() DB::commit(); } catch (\Exception $e) { DB::rollback(); - dd($e); } - echo 'Ho gaya bc'; } } diff --git a/app/Http/Controllers/MembersController.php b/app/Http/Controllers/MembersController.php index 3c108e2c..5718de3e 100755 --- a/app/Http/Controllers/MembersController.php +++ b/app/Http/Controllers/MembersController.php @@ -161,11 +161,11 @@ public function store(Request $request) // Adding media i.e. Profile & proof photo if ($request->hasFile('photo')) { - $member->addMedia($request->file('photo'))->usingFileName('profile_'.$member->id.$request->photo->getClientOriginalExtension())->toCollection('profile'); + $member->addMedia($request->file('photo'))->usingFileName('profile_'.$member->id.'.'.$request->photo->getClientOriginalExtension())->toCollection('profile'); } if ($request->hasFile('proof_photo')) { - $member->addMedia($request->file('proof_photo'))->usingFileName('proof_'.$member->id.$request->proof_photo->getClientOriginalExtension())->toCollection('proof'); + $member->addMedia($request->file('proof_photo'))->usingFileName('proof_'.$member->id.'.'.$request->proof_photo->getClientOriginalExtension())->toCollection('proof'); } // Helper function for calculating payment status @@ -223,10 +223,10 @@ public function store(Request $request) 'plan_id'=> $plan['id'], 'item_amount'=> $plan['price'], ]; - $invoice_details = new InvoiceDetail($detailsData); - $invoice_details->createdBy()->associate(Auth::user()); - $invoice_details->updatedBy()->associate(Auth::user()); - $invoice_details->save(); + $invoiceDetails = new InvoiceDetail($detailsData); + $invoiceDetails->createdBy()->associate(Auth::user()); + $invoiceDetails->updatedBy()->associate(Auth::user()); + $invoiceDetails->save(); } // Store Payment Details @@ -235,14 +235,14 @@ public function store(Request $request) 'mode'=> $request->mode, 'note'=> ' ', ]; - $payment_details = new PaymentDetail($paymentData); - $payment_details->createdBy()->associate(Auth::user()); - $payment_details->updatedBy()->associate(Auth::user()); - $payment_details->save(); + $paymentDetails = new PaymentDetail($paymentData); + $paymentDetails->createdBy()->associate(Auth::user()); + $paymentDetails->updatedBy()->associate(Auth::user()); + $paymentDetails->save(); if ($request->mode == 0) { // Store Cheque Details - $chequeData = ['payment_id'=> $payment_details->id, + $chequeData = ['payment_id'=> $paymentDetails->id, 'number'=> $request->number, 'date'=> $request->date, 'status'=> \constChequeStatus::Recieved, ]; @@ -271,14 +271,14 @@ public function store(Request $request) if ($invoice->status == \constPaymentStatus::Paid) { $sms_trigger = SmsTrigger::where('alias', '=', 'member_admission_with_paid_invoice')->first(); $message = $sms_trigger->message; - $sms_text = sprintf($message, $member->name, $gym_name, $payment_details->payment_amount, $invoice->invoice_number); + $sms_text = sprintf($message, $member->name, $gym_name, $paymentDetails->payment_amount, $invoice->invoice_number); $sms_status = $sms_trigger->status; \Utilities::Sms($sender_id, $member->contact, $sms_text, $sms_status); } elseif ($invoice->status == \constPaymentStatus::Partial) { $sms_trigger = SmsTrigger::where('alias', '=', 'member_admission_with_partial_invoice')->first(); $message = $sms_trigger->message; - $sms_text = sprintf($message, $member->name, $gym_name, $payment_details->payment_amount, $invoice->invoice_number, $invoice->pending_amount); + $sms_text = sprintf($message, $member->name, $gym_name, $paymentDetails->payment_amount, $invoice->invoice_number, $invoice->pending_amount); $sms_status = $sms_trigger->status; \Utilities::Sms($sender_id, $member->contact, $sms_text, $sms_status); @@ -286,7 +286,7 @@ public function store(Request $request) if ($request->mode == 0) { $sms_trigger = SmsTrigger::where('alias', '=', 'payment_with_cheque')->first(); $message = $sms_trigger->message; - $sms_text = sprintf($message, $member->name, $payment_details->payment_amount, $cheque_details->number, $invoice->invoice_number, $gym_name); + $sms_text = sprintf($message, $member->name, $paymentDetails->payment_amount, $cheque_details->number, $invoice->invoice_number, $gym_name); $sms_status = $sms_trigger->status; \Utilities::Sms($sender_id, $member->contact, $sms_text, $sms_status); @@ -309,15 +309,15 @@ public function store(Request $request) $invoice->updated_at = $subscription->start_date; $invoice->save(); - foreach ($invoice->invoice_details as $invoice_detail) { - $invoice_detail->created_at = $subscription->start_date; - $invoice_detail->updated_at = $subscription->start_date; - $invoice_detail->save(); + foreach ($invoice->invoiceDetails as $invoiceDetail) { + $invoiceDetail->created_at = $subscription->start_date; + $invoiceDetail->updated_at = $subscription->start_date; + $invoiceDetail->save(); } - $payment_details->created_at = $subscription->start_date; - $payment_details->updated_at = $subscription->start_date; - $payment_details->save(); + $paymentDetails->created_at = $subscription->start_date; + $paymentDetails->updated_at = $subscription->start_date; + $paymentDetails->save(); $subscription->created_at = $subscription->start_date; $subscription->updated_at = $subscription->start_date; @@ -361,18 +361,17 @@ public function edit($id) */ public function update($id, Request $request) { - //dd($request->all()); $member = Member::findOrFail($id); $member->update($request->all()); if ($request->hasFile('photo')) { $member->clearMediaCollection('profile'); - $member->addMedia($request->file('photo'))->usingFileName('profile_'.$member->id.$request->photo->getClientOriginalExtension())->toCollection('profile'); + $member->addMedia($request->file('photo'))->usingFileName('profile_'.$member->id.'.'.$request->photo->getClientOriginalExtension())->toCollection('profile'); } if ($request->hasFile('proof_photo')) { $member->clearMediaCollection('proof'); - $member->addMedia($request->file('proof_photo'))->usingFileName('proof_'.$member->id.$request->proof_photo->getClientOriginalExtension())->toCollection('proof'); + $member->addMedia($request->file('proof_photo'))->usingFileName('proof_'.$member->id.'.'.$request->proof_photo->getClientOriginalExtension())->toCollection('proof'); } $member->updatedBy()->associate(Auth::user()); @@ -396,11 +395,11 @@ public function archive($id, Request $request) foreach ($invoices as $invoice) { InvoiceDetail::where('invoice_id', $invoice->id)->delete(); - $payment_details = PaymentDetail::where('invoice_id', $invoice->id)->get(); + $paymentDetails = PaymentDetail::where('invoice_id', $invoice->id)->get(); - foreach ($payment_details as $payment_detail) { - ChequeDetail::where('payment_id', $payment_detail->id)->delete(); - $payment_detail->delete(); + foreach ($paymentDetails as $paymentDetail) { + ChequeDetail::where('payment_id', $paymentDetail->id)->delete(); + $paymentDetail->delete(); } $invoice->delete(); diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php deleted file mode 100755 index 52ce5160..00000000 --- a/app/Http/Controllers/ReportsController.php +++ /dev/null @@ -1,78 +0,0 @@ -middleware('auth'); - } - - // ################### Charts Methods ##################### - - public function gymMemberCharts() - { - return view('reports.members.charts'); - } - - public function enquiryCharts() - { - return view('reports.enquiries.charts'); - } - - public function subscriptionCharts() - { - return view('reports.subscriptions.charts'); - } - - public function paymentCharts() - { - return view('reports.payments.charts'); - } - - public function expenseCharts() - { - return view('reports.expenses.charts'); - } - - public function invoiceCharts() - { - return view('reports.invoices.charts'); - } - - // ################ Data Methods ##################### - - public function gymMemberData(Request $request) - { - return view('reports.members.data'); - } - - public function enquiryData() - { - return view('reports.enquiries.data'); - } - - public function subscriptionData() - { - return view('reports.subscriptions.data'); - } - - public function paymentData() - { - return view('reports.payments.data'); - } - - public function expenseData() - { - return view('reports.expenses.data'); - } - - public function invoiceData() - { - return view('reports.invoices.data'); - } -} diff --git a/app/Http/routes.php b/app/Http/routes.php index 1a1c3c9f..9a3aa099 100755 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -81,22 +81,6 @@ Route::get('{id}/transfer', ['middleware' => ['permission:manage-gymie|manage-enquiries|transfer-enquiry'], 'uses' => 'MembersController@transfer']); }); -//ReportsController -Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () { - Route::get('members/charts', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@gymMemberCharts']); - Route::get('members/data', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@gymMemberData']); - Route::get('enquiries/charts', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@enquiryCharts']); - Route::get('enquiries/data', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@enquiryData']); - Route::get('subscriptions/charts', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@subscriptionCharts']); - Route::get('subscriptions/data', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@subscriptionData']); - Route::get('payments/charts', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@paymentCharts']); - Route::get('payments/data', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@paymentData']); - Route::get('expenses/charts', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@expenseCharts']); - Route::get('expenses/data', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@expenseData']); - Route::get('invoices/charts', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@invoiceCharts']); - Route::get('invoices/data', ['middleware' => ['permission:manage-gymie|manage-reports|view-report'], 'uses' => 'ReportsController@invoiceData']); -}); - //SmsController Route::group(['prefix' => 'sms', 'middleware' => ['auth']], function () { Route::get('triggers', ['middleware' => ['permission:manage-gymie|manage-sms'], 'uses' => 'SmsController@triggersIndex']); @@ -151,16 +135,6 @@ Route::post('services/{id}/delete', ['middleware' => ['permission:manage-gymie|manage-services|delete-service'], 'uses' => 'ServicesController@delete']); }); -//services -// Route::group(['prefix' => 'services','middleware' => ['auth']], function() { -// Route::get('/',['middleware' => ['permission:manage-gymie|manage-services|view-service'],'uses' => 'ServicesController@index']); -// Route::get('all',['middleware' => ['permission:manage-gymie|manage-services|view-service'],'uses' => 'ServicesController@index']); -// Route::get('create',['middleware' => ['permission:manage-gymie|manage-services|add-service'],'uses' => 'ServicesController@create']); -// Route::post('/',['middleware' => ['permission:manage-gymie|manage-services|add-service'],'uses' => 'ServicesController@store']); -// Route::get('{id}/edit',['middleware' => ['permission:manage-gymie|manage-services|edit-service'],'uses' => 'ServicesController@edit']); -// Route::post('{id}/update',['middleware' => ['permission:manage-gymie|manage-services|edit-service'],'uses' => 'ServicesController@update']); -// }); - //subsciptions Route::group(['prefix' => 'subscriptions', 'middleware' => ['auth']], function () { Route::get('/', ['middleware' => ['permission:manage-gymie|manage-subscriptions|view-subscription'], 'uses' => 'SubscriptionsController@index']); @@ -194,11 +168,6 @@ Route::post('{id}/applyDiscount', ['middleware' => ['permission:manage-gymie|manage-invoices|add-discount'], 'uses' => 'InvoicesController@applyDiscount']); }); -//activities -// Route::get('access_logs','Access_logsController@index'); -// Route::get('access_logs/show','Access_logsController@show'); -// Route::get('access_logs/create','Access_logsController@create'); - //payments Route::group(['prefix' => 'payments', 'middleware' => ['auth']], function () { Route::get('/', ['middleware' => ['permission:manage-gymie|manage-payments|view-payment'], 'uses' => 'PaymentsController@index']); @@ -215,17 +184,6 @@ Route::post('{id}/delete', ['middleware' => ['permission:manage-gymie|manage-payments|delete-payment'], 'uses' => 'PaymentsController@delete']); }); -//expense Categories -// Route::group(['prefix' => 'expenseCategories','middleware' => ['auth']], function() { -// Route::get('/',['middleware' => ['permission:manage-gymie|manage-expenseCategories|view-expenseCategory'],'uses' => 'ExpenseCategoriesController@index']); -// Route::get('all',['middleware' => ['permission:manage-gymie|manage-expenseCategories|view-expenseCategory'],'uses' => 'ExpenseCategoriesController@index']); -// Route::get('create',['middleware' => ['permission:manage-gymie|manage-expenseCategories|add-expenseCategory'],'uses' => 'ExpenseCategoriesController@create']); -// Route::post('/',['middleware' => ['permission:manage-gymie|manage-expenseCategories|add-expenseCategory'],'uses' => 'ExpenseCategoriesController@store']); -// Route::get('{id}/edit',['middleware' => ['permission:manage-gymie|manage-expenseCategories|edit-expenseCategory'],'uses' => 'ExpenseCategoriesController@edit']); -// Route::post('{id}/update',['middleware' => ['permission:manage-gymie|manage-expenseCategories|edit-expenseCategory'],'uses' => 'ExpenseCategoriesController@update']); -// Route::post('{id}/archive',['middleware' => ['permission:manage-gymie|manage-expenseCategories|delete-expenseCategory'],'uses' => 'ExpenseCategoriesController@archive']); -// }); - //expenses Route::group(['prefix' => 'expenses', 'middleware' => ['auth']], function () { Route::get('/', ['middleware' => ['permission:manage-gymie|manage-expenses|view-expense'], 'uses' => 'ExpensesController@index']); @@ -254,8 +212,8 @@ }); //User Module with roles & permissions +//User Route::group(['prefix' => 'user', 'middleware' => ['permission:manage-gymie|manage-users', 'auth']], function () { - //User Route::get('/', 'AclController@userIndex'); Route::get('create', 'AclController@createUser'); Route::post('/', 'AclController@storeUser'); @@ -264,8 +222,8 @@ Route::post('{id}/delete', 'AclController@deleteUser'); }); +//Roles Route::group(['prefix' => 'user/role', 'middleware' => ['permission:manage-gymie|manage-users', 'auth']], function () { - //Roles Route::get('/', 'AclController@roleIndex'); Route::get('create', 'AclController@createRole'); Route::post('/', 'AclController@storeRole'); @@ -274,8 +232,8 @@ Route::post('{id}/delete', 'AclController@deleteRole'); }); +//Permissions Route::group(['prefix' => 'user/permission', 'middleware' => ['auth', 'role:Gymie']], function () { - //Permissions Route::get('/', 'AclController@permissionIndex'); Route::get('create', 'AclController@createPermission'); Route::post('/', 'AclController@storePermission'); diff --git a/app/Invoice.php b/app/Invoice.php index 8c94246b..675e7b05 100755 --- a/app/Invoice.php +++ b/app/Invoice.php @@ -51,22 +51,22 @@ public function scopeIndexQuery($query, $sorting_field, $sorting_direction, $drp return $query->leftJoin('mst_members', 'trn_invoice.member_id', '=', 'mst_members.id')->select('trn_invoice.*', 'mst_members.name as member_name')->whereBetween('trn_invoice.created_at', [$drp_start, $drp_end])->orderBy($sorting_field, $sorting_direction); } - public function Member() + public function member() { return $this->belongsTo('App\Member', 'member_id'); } - public function PaymentDetails() + public function paymentDetails() { return $this->hasMany('App\PaymentDetail'); } - public function InvoiceDetails() + public function invoiceDetails() { return $this->hasMany('App\InvoiceDetail'); } - public function Subscription() + public function subscription() { return $this->hasOne('App\Subscription'); } diff --git a/app/InvoiceDetail.php b/app/InvoiceDetail.php index 5e52150f..11426f56 100644 --- a/app/InvoiceDetail.php +++ b/app/InvoiceDetail.php @@ -20,12 +20,12 @@ class InvoiceDetail extends Model 'updated_by', ]; - public function Invoice() + public function invoice() { return $this->belongsTo('App\Invoice', 'invoice_id'); } - public function Plan() + public function plan() { return $this->belongsTo('App\Plan', 'plan_id'); } diff --git a/app/Member.php b/app/Member.php index eed44cb2..b5e38529 100755 --- a/app/Member.php +++ b/app/Member.php @@ -53,12 +53,12 @@ public function registerMediaConversions() } //Relationships - public function Subscriptions() + public function subscriptions() { return $this->hasMany('App\Subscription'); } - public function Invoices() + public function invoices() { return $this->hasMany('App\Invoice'); } @@ -79,19 +79,6 @@ public function scopeIndexQuery($query, $sorting_field, $sorting_direction, $drp ])->orderBy($sorting_field, $sorting_direction); } - // public function scopeReportQuery($query,$sorting_field,$sorting_direction,$drp_start,$drp_end) - // { - // $sorting_field = ($sorting_field != null ? $sorting_field : 'created_at'); - // $sorting_direction = ($sorting_direction != null ? $sorting_direction : 'desc'); - - // if ($drp_start == null or $drp_end == null) - // { - // return $query->leftJoin('mst_plans', 'mst_members.plan_id', '=', 'mst_plans.id')->select('mst_members.*','mst_plans.plan_name')->where('mst_members.status','!=', \constStatus::Archive)->orderBy($sorting_field,$sorting_direction); - // } - - // return $query->leftJoin('mst_plans', 'mst_members.plan_id', '=', 'mst_plans.id')->select('mst_members.*','mst_plans.plan_name')->where('mst_members.status','!=', \constStatus::Archive)->whereBetween('mst_members.created_at', [$drp_start, $drp_end])->orderBy($sorting_field,$sorting_direction); - // } - public function scopeActive($query) { return $query->where('status', '=', \constStatus::Active); diff --git a/app/PaymentDetail.php b/app/PaymentDetail.php index 13519ef1..18cba818 100644 --- a/app/PaymentDetail.php +++ b/app/PaymentDetail.php @@ -43,12 +43,12 @@ public function scopeIndexQuery($query, $sorting_field, $sorting_direction, $drp ])->orderBy($sorting_field, $sorting_direction); } - public function Invoice() + public function invoice() { return $this->belongsTo('App\Invoice', 'invoice_id'); } - public function Cheque() + public function cheque() { return $this->hasOne('App\ChequeDetail', 'payment_id'); } diff --git a/app/Permission.php b/app/Permission.php index 3341d9b1..610c70e3 100755 --- a/app/Permission.php +++ b/app/Permission.php @@ -15,7 +15,7 @@ class Permission extends EntrustPermission 'group_key', ]; - public function Roles() + public function roles() { return $this->belongsToMany('App\Role'); } diff --git a/app/Permission_role.php b/app/PermissionRole.php similarity index 86% rename from app/Permission_role.php rename to app/PermissionRole.php index e298b28e..9bfce171 100755 --- a/app/Permission_role.php +++ b/app/PermissionRole.php @@ -4,7 +4,7 @@ use Illuminate\Database\Eloquent\Model; -class Permission_role extends Model +class PermissionRole extends Model { protected $table = 'permission_role'; diff --git a/app/Plan.php b/app/Plan.php index c2dc686a..b4145df2 100755 --- a/app/Plan.php +++ b/app/Plan.php @@ -47,12 +47,12 @@ public function scopeOnlyActive($query) return $query->where('status', '=', \constStatus::Active); } - public function Subscriptions() + public function subscriptions() { return $this->hasMany('App\Subscription', 'plan_id'); } - public function Service() + public function service() { return $this->belongsTo('App\Service', 'service_id'); } diff --git a/app/Role.php b/app/Role.php index e44ee8ae..cd0b89a4 100755 --- a/app/Role.php +++ b/app/Role.php @@ -15,17 +15,17 @@ class Role extends EntrustRole 'description', ]; - public function Users() + public function users() { return $this->belongsToMany('App\User'); } - public function Permissions() + public function permissions() { return $this->hasMany('App\Permission'); } - public function RoleUsers() + public function roleUsers() { return $this->belongsToMany('App\RoleUser'); } diff --git a/app/RoleUser.php b/app/RoleUser.php index b16d29fb..76f0513c 100644 --- a/app/RoleUser.php +++ b/app/RoleUser.php @@ -15,12 +15,12 @@ class RoleUser extends Model 'role_id', ]; - public function User() + public function user() { return $this->belongsTo('App\User'); } - public function Role() + public function role() { return $this->belongsTo('App\Role'); } diff --git a/app/Service.php b/app/Service.php index bc58779f..20d0812d 100755 --- a/app/Service.php +++ b/app/Service.php @@ -25,7 +25,7 @@ class Service extends Model 'description' => 10, ]; - public function Plans() + public function plans() { return $this->hasMany('App\Plan', 'service_id'); } diff --git a/app/Subscription.php b/app/Subscription.php index 9e2390a3..d9f51155 100755 --- a/app/Subscription.php +++ b/app/Subscription.php @@ -83,17 +83,17 @@ public function scopeExpired($query, $sorting_field, $sorting_direction, $drp_st return $query->leftJoin('mst_plans', 'trn_subscriptions.plan_id', '=', 'mst_plans.id')->select('trn_subscriptions.*', 'mst_plans.plan_name')->where('trn_subscriptions.status', '=', \constSubscription::Expired)->where('trn_subscriptions.status', '!=', \constSubscription::renewed)->whereBetween('trn_subscriptions.created_at', [$drp_start, $drp_end])->orderBy($sorting_field, $sorting_direction); } - public function Member() + public function member() { return $this->belongsTo('App\Member', 'member_id'); } - public function Plan() + public function plan() { return $this->belongsTo('App\Plan', 'plan_id'); } - public function Invoice() + public function invoice() { return $this->belongsTo('App\Invoice', 'invoice_id'); } diff --git a/app/User.php b/app/User.php index eb337849..53f00c72 100755 --- a/app/User.php +++ b/app/User.php @@ -59,7 +59,7 @@ public function scopeExcludeArchive($query) return $query->where('status', '!=', \constStatus::Archive); } - public function RoleUser() + public function roleUser() { return $this->hasOne('App\RoleUser'); } diff --git a/resources/views/dashboard/_index/birthdays.blade.php b/resources/views/dashboard/_index/birthdays.blade.php index 830a59b0..88994875 100644 --- a/resources/views/dashboard/_index/birthdays.blade.php +++ b/resources/views/dashboard/_index/birthdays.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($birthdays as $birthday) diff --git a/resources/views/dashboard/_index/bouncedCheques.blade.php b/resources/views/dashboard/_index/bouncedCheques.blade.php index 812a259e..722f9c3f 100644 --- a/resources/views/dashboard/_index/bouncedCheques.blade.php +++ b/resources/views/dashboard/_index/bouncedCheques.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($bouncedCheques as $bouncedCheque) diff --git a/resources/views/dashboard/_index/depositedCheques.blade.php b/resources/views/dashboard/_index/depositedCheques.blade.php index 500f4bcd..0d501d98 100644 --- a/resources/views/dashboard/_index/depositedCheques.blade.php +++ b/resources/views/dashboard/_index/depositedCheques.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($depositedCheques as $depositedCheque) diff --git a/resources/views/dashboard/_index/due.blade.php b/resources/views/dashboard/_index/due.blade.php index b1233a2d..143d38bc 100644 --- a/resources/views/dashboard/_index/due.blade.php +++ b/resources/views/dashboard/_index/due.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($dues as $due) diff --git a/resources/views/dashboard/_index/enquiries.blade.php b/resources/views/dashboard/_index/enquiries.blade.php index 14ea24cb..81a83998 100644 --- a/resources/views/dashboard/_index/enquiries.blade.php +++ b/resources/views/dashboard/_index/enquiries.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($enquiries as $enquiry) diff --git a/resources/views/dashboard/_index/expired.blade.php b/resources/views/dashboard/_index/expired.blade.php index 0e033ee3..e1a05970 100644 --- a/resources/views/dashboard/_index/expired.blade.php +++ b/resources/views/dashboard/_index/expired.blade.php @@ -1,4 +1,7 @@ -
+ +
@forelse($allExpired as $expired) diff --git a/resources/views/dashboard/_index/expiring.blade.php b/resources/views/dashboard/_index/expiring.blade.php index 240b360f..c4632f4e 100644 --- a/resources/views/dashboard/_index/expiring.blade.php +++ b/resources/views/dashboard/_index/expiring.blade.php @@ -1,4 +1,7 @@ -
+ +
@forelse($expirings as $expiring) diff --git a/resources/views/dashboard/_index/outStanding.blade.php b/resources/views/dashboard/_index/outStanding.blade.php index 12ff4b16..db6f3e62 100644 --- a/resources/views/dashboard/_index/outStanding.blade.php +++ b/resources/views/dashboard/_index/outStanding.blade.php @@ -1,5 +1,5 @@ -
+
@forelse($outstandings as $outstanding) diff --git a/resources/views/dashboard/_index/receivedCheque.blade.php b/resources/views/dashboard/_index/receivedCheque.blade.php index 0473deef..42815462 100644 --- a/resources/views/dashboard/_index/receivedCheque.blade.php +++ b/resources/views/dashboard/_index/receivedCheque.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($recievedCheques as $recievedCheque) diff --git a/resources/views/dashboard/_index/recents.blade.php b/resources/views/dashboard/_index/recents.blade.php index 983d8ae5..8e8bdf56 100644 --- a/resources/views/dashboard/_index/recents.blade.php +++ b/resources/views/dashboard/_index/recents.blade.php @@ -1,4 +1,7 @@ -
+ +
@forelse($recents as $recent) diff --git a/resources/views/dashboard/_index/reminders.blade.php b/resources/views/dashboard/_index/reminders.blade.php index 6eeff0af..5125df47 100644 --- a/resources/views/dashboard/_index/reminders.blade.php +++ b/resources/views/dashboard/_index/reminders.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($reminders as $reminder) diff --git a/resources/views/dashboard/_index/smsLog.blade.php b/resources/views/dashboard/_index/smsLog.blade.php index ecae248d..13264b1b 100644 --- a/resources/views/dashboard/_index/smsLog.blade.php +++ b/resources/views/dashboard/_index/smsLog.blade.php @@ -1,4 +1,4 @@ -
+
@forelse($smslogs as $smslog) diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index f7ffad74..867f19f7 100755 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -3,10 +3,6 @@ @section('content')
- -
@include('flash::message') diff --git a/resources/views/invoices/discount.blade.php b/resources/views/invoices/discount.blade.php index 584af87f..3710aa09 100755 --- a/resources/views/invoices/discount.blade.php +++ b/resources/views/invoices/discount.blade.php @@ -40,7 +40,7 @@ {!! Form::label('subscription_amount','Subscription fee') !!}
- {!! Form::text('subscription_amount',$invoice->invoice_details->sum('item_amount'),['class'=>'form-control', 'id' => 'subscription_amount','readonly' => 'readonly']) !!} + {!! Form::text('subscription_amount',$invoice->invoiceDetails->sum('item_amount'),['class'=>'form-control', 'id' => 'subscription_amount','readonly' => 'readonly']) !!}
diff --git a/resources/views/invoices/show.blade.php b/resources/views/invoices/show.blade.php index 64b16d9b..f9cda0e9 100755 --- a/resources/views/invoices/show.blade.php +++ b/resources/views/invoices/show.blade.php @@ -35,7 +35,7 @@ Payment Mode(s)
payment_details->unique('mode') as $payment_mode) { + foreach ($invoice->paymentDetails->unique('mode') as $payment_mode) { $modes[] = Utilities::getPaymentMode($payment_mode->mode); } echo implode($modes, ','); @@ -72,10 +72,10 @@ - @foreach ($invoice->invoice_details as $invoice_detail) + @foreach ($invoice->invoiceDetails as $invoiceDetail) - - + + @endforeach @@ -147,11 +147,11 @@ class="ion-card margin-right-5"> Accept Payment - @foreach ($invoice->payment_details as $payment_detail) + @foreach ($invoice->paymentDetails as $paymentDetail) - - - + + + @endforeach diff --git a/resources/views/reports/enquiries/charts.blade.php b/resources/views/reports/enquiries/charts.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/enquiries/charts.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/enquiries/data.blade.php b/resources/views/reports/enquiries/data.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/enquiries/data.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/expenses/charts.blade.php b/resources/views/reports/expenses/charts.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/expenses/charts.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/expenses/data.blade.php b/resources/views/reports/expenses/data.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/expenses/data.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/invoices/charts.blade.php b/resources/views/reports/invoices/charts.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/invoices/charts.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/invoices/data.blade.php b/resources/views/reports/invoices/data.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/invoices/data.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/members/charts.blade.php b/resources/views/reports/members/charts.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/members/charts.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/members/data.blade.php b/resources/views/reports/members/data.blade.php deleted file mode 100755 index 5b943a51..00000000 --- a/resources/views/reports/members/data.blade.php +++ /dev/null @@ -1,80 +0,0 @@ -@extends('app') - -@section('header_scripts') - - - - - - - - - -@stop - -@section('content') - - - -
- -
- @include('flash::message') -

Members - @permission(['manage-gymie','manage-members','add-member']) - Data of all gym members -

- @endpermission -
- -
-
- -
- -
- -
-
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/payments/charts.blade.php b/resources/views/reports/payments/charts.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/payments/charts.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/payments/data.blade.php b/resources/views/reports/payments/data.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/payments/data.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/subscriptions/charts.blade.php b/resources/views/reports/subscriptions/charts.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/subscriptions/charts.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/reports/subscriptions/data.blade.php b/resources/views/reports/subscriptions/data.blade.php deleted file mode 100755 index e63ac327..00000000 --- a/resources/views/reports/subscriptions/data.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('app') - -@section('content') - -
- -
- -@stop \ No newline at end of file diff --git a/resources/views/user/editUser.blade.php b/resources/views/user/editUser.blade.php index 31d0e082..cdf4cfe0 100755 --- a/resources/views/user/editUser.blade.php +++ b/resources/views/user/editUser.blade.php @@ -105,7 +105,7 @@ $withGymie = App\Role::lists('name', 'id'); ?> {!! Form::label('Role') !!} - {!! Form::select('role_id',(Auth::User()->hasRole('Gymie') ? $withGymie : $withoutGymie),$user->role_user->role_id,['class'=>'form-control selectpicker show-tick', 'id' => 'role_id']) !!} + {!! Form::select('role_id',(Auth::User()->hasRole('Gymie') ? $withGymie : $withoutGymie),$user->roleUser->role_id,['class'=>'form-control selectpicker show-tick', 'id' => 'role_id']) !!} diff --git a/resources/views/user/userIndex.blade.php b/resources/views/user/userIndex.blade.php index c5a24eb8..7bd39cce 100755 --- a/resources/views/user/userIndex.blade.php +++ b/resources/views/user/userIndex.blade.php @@ -39,7 +39,7 @@ - +
{{ $invoice_detail->plan->plan_name }}{{ $invoice_detail->item_amount }}{{ $invoiceDetail->plan->plan_name }}{{ $invoiceDetail->item_amount }}
{{ ($payment_detail->payment_amount >= 0 ? $payment_detail->payment_amount : str_replace("-","",$payment_detail->payment_amount)." (Paid)") }}{{ Utilities::getPaymentMode ($payment_detail->mode) }}{{ $payment_detail->created_at->toDayDateTimeString() }}{{ ($paymentDetail->payment_amount >= 0 ? $paymentDetail->payment_amount : str_replace("-","",$paymentDetail->payment_amount)." (Paid)") }}{{ Utilities::getPaymentMode ($paymentDetail->mode) }}{{ $paymentDetail->created_at->toDayDateTimeString() }}
{{ $user->name}} {{ $user->email}}{{ $user->role_user->role->name }}{{ $user->roleUser->role->name }}