Файловый менеджер - Редактировать - /home/clickysoft/public_html/benchexc.clickysoft.net/app/Repositories/Admin/TechStackRepository.php
Назад
<?php namespace App\Repositories\Admin; use App\Interfaces\Admin\TechStackRepositoryInterface; use App\Models\TechStack; use http\Env\Request; use Illuminate\Routing\Route; use Yajra\DataTables\Facades\DataTables; class TechStackRepository implements TechStackRepositoryInterface { public function getDataTable() { $query = TechStack::query(); // $query = User::where('id', '!=', Auth::id()); return Datatables::of($query) ->filter(function ($instance) { $search = request('search')['value']; if (!empty($search)) { $instance->where(function ($w) use ($search) { $w->orWhere('technologies', 'LIKE', "%$search%") ->orWhere('Skills', 'LIKE', "%$search%"); if (strtolower($search) === "unverified") { $w->orWhere('is_verified', 0); } elseif (strtolower($search) === "verified") { $w->orWhere('is_verified', 1); } }); } }) // ->editColumn('is_active', function ($obj) { // return !empty($obj->is_active) ? ' verified' : 'unverified'; // }) // ->addColumn('role',function ($obj){ // $roleNames = $obj->role->name; // return implode(', ', $roleNames); // }) // ->editColumn('is_active', function ($obj) { // $isChecked = ""; // if(!empty($obj->is_active)){ // $isChecked = "checked"; // } // // $switchBtn = '<label class="switch switch-success"> // <input type="checkbox" class="switch-input" '.$isChecked.' onclick="changeStatus(`'.route('user.change.status', $obj->id).'`)" /> // <span class="switch-toggle-slider"> // <span class="switch-on"> // <i class="bx bx-check"></i> // </span> // <span class="switch-off"> // <i class="bx bx-x"></i> // </span> // </span> // </label>'; // // return $switchBtn; // }) ->addColumn('action', function ($obj) { $buttons = ' <a class="btn btn-primary redirect-btn" href="' . route('tech-stacks.update', $obj->id) . '">Update</a>'; return $buttons . ' <button class="btn btn-danger redirect-btn" onclick="deleteData(`' . route('tech-stacks.destroy', $obj->id) . '`)">Delete</button>'; })->rawColumns(['is_active', 'action'])->make(true); } public function create($request) { $techSkills = TechStack::create([ 'technologies'=>$request->input('technologies'), 'Skills'=>$request->input('Skills') ]); return redirect()->route('tech-stack')->with('success_msg', 'Tech Stack successfully added.'); } public function update($request,$id) { $techStack = TechStack::where('id',$id)->first(); $techStack->update([ 'technologies'=>$request->input('technologies'), 'Skills'=>$request->input('Skills') ]); return redirect()->route('tech-stack')->with('success_msg', 'Tech Stack successfully updated.'); } public function destroyTechStack($id) { $techStack = TechStack::where('id',$id)->first(); $techStack->delete(); return redirect()->back()->with('success_msg', 'Tech Stack successfully delete.'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка