Replace deprecated array and string helpers

Laravel recommends using the `Str` and `Arr` class methods directly instead of the respective helper functions. These helper functions are deprecated in Laravel 5.8 and removed in Laravel 6.
This commit is contained in:
Shift
2023-01-06 11:53:35 +00:00
parent 03623d493d
commit b02541ac64
28 changed files with 91 additions and 70 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Agent\kb;
// Controllers
use Illuminate\Support\Str;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller;
// Requests
@@ -77,7 +78,7 @@ class CategoryController extends Controller
->addColumn('name', function ($model) {
$string = strip_tags($model->name);
return str_limit($string, 20);
return Str::limit($string, 20);
})
/* add column Created */
->addColumn('Created', function ($model) {
@@ -140,7 +141,7 @@ class CategoryController extends Controller
{
/* Get the whole request from the form and insert into table via model */
$sl = $request->input('name');
$slug = str_slug($sl, '-');
$slug = Str::slug($sl, '-');
$category->slug = $slug;
// send success message to index page
try {
@@ -182,7 +183,7 @@ class CategoryController extends Controller
/* Edit the selected category via id */
$category = Category::where('id', $id)->first();
$sl = $request->input('name');
$slug = str_slug($sl, '-');
$slug = Str::slug($sl, '-');
/* update the values at the table via model according with the request */
//redirct to index page with success message
try {