Viewing file: StepDetailsController.php (1.98 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Http\Controllers\Customer;
use App\Http\Controllers\Controller; use App\Models\Customer; use App\Models\CustomerStep; use App\Models\CustomerStepDetail; use Illuminate\Http\Request;
class StepDetailsController extends Controller { public function index(){ return view('customer.step_details.index'); } public function getAll(Request $request) { $customer_steps = CustomerStep::where('customer_id',auth()->user()->id)->orderByDesc('created_at')->get(); return datatables()->of($customer_steps)
// ->addColumn('profile', function (CustomerStep $q) { // $img = asset('uploads/' . $q->image) ; // $profile = '<a href="#" class="customer-img-show" data-img="'.$img.'"> // <div class="profile-img-sec"> // <img src="' . $img . '" height="40" width="45"> // </div> // </a>';
// return $profile; // }) ->addColumn('step', function (CustomerStep $q) { $title = ucfirst($q->plan->title); $step = 'Step For Plan : '. $title; return $step; }) ->addColumn('created_at', function (CustomerStep $q) { return $q->created_at->format('d-m-Y'); })
->addColumn('action', function (CustomerStep $q) { return "<a class='btn btn-sm btn-info' href='" . route('customer.steps.details', [$q->id]) . "'>Details</a> "; }) ->rawColumns(['action','step','profile']) ->toJson(); } public function step_details($id){ $customer_step = CustomerStep::findOrFail($id); $data['customer_step_details'] = CustomerStepDetail::where('customer_step_id', $customer_step->id)->get(); $customer = Customer::findOrFail($customer_step->customer_id);
$data['current_plan'] = $customer->plan;
return view('customer.step_details.details',$data); } }
|