Skip to content

Commit 559d79c

Browse files
committed
Replace str_random with Str::random
1 parent c45581f commit 559d79c

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/Controllers/BaseController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Auth;
88
use Illuminate\Support\Facades\View;
99
use Route;
10+
use Str;
1011

1112
class BaseController extends Controller
1213
{
@@ -160,7 +161,7 @@ public function navigation()
160161

161162
// Add each navigation item the user has access to
162163
foreach ($this->user['modules'] as $id => $item) {
163-
$response .= $this->navigationLI($id == $this->slug, str_slug($id), $item['title'], $item['icon']);
164+
$response .= $this->navigationLI($id == $this->slug, Str::slug($id), $item['title'], $item['icon']);
164165
if (isset($item['sub_navigation']) && isset($item['treeview']) && class_exists($item['model'])) {
165166
$data = new $item['model'];
166167
$data = $this->sortModel($data, @$item['orderByDesc'], 'desc');
@@ -175,9 +176,9 @@ public function navigation()
175176
if ((new $item['model'])->where($item['treeview'], $subitem->id)->count()) {
176177
$count++;
177178
if ($count == 1 && isset($item['sub_showall']) && $item['sub_showall']) {
178-
$subresponse .= $this->navigationLI($id == $this->slug && !request()->root, str_slug($id), $item['sub_showall'] === true ? trans('admin::base.showall') : $this->locale('sub_showall', $item, false)) . '</li>';
179+
$subresponse .= $this->navigationLI($id == $this->slug && !request()->root, Str::slug($id), $item['sub_showall'] === true ? trans('admin::base.showall') : $this->locale('sub_showall', $item, false)) . '</li>';
179180
}
180-
$subresponse .= $this->navigationLI($id == $this->slug && request()->root == $subitem->id, str_slug($id) . '?root=' . $subitem->id, $subitem[$item['sub_navigation']]) . '</li>';
181+
$subresponse .= $this->navigationLI($id == $this->slug && request()->root == $subitem->id, Str::slug($id) . '?root=' . $subitem->id, $subitem[$item['sub_navigation']]) . '</li>';
181182
}
182183
}
183184
$subresponse .= '</ul>';

src/Controllers/ReportController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace NickDeKruijk\Admin\Controllers;
44

55
use DB;
6+
use Str;
67

78
class ReportController extends BaseController
89
{
@@ -11,7 +12,7 @@ public static function reports($lp)
1112
$lp->checkSlug($lp->slug, 'read');
1213
$response = '<ul>';
1314
foreach ($lp->module('queries') as $queryId => $query) {
14-
$response .= '<li data-url="' . route('report', ['slug' => $lp->slug, 'id' => str_slug($queryId)]) . '">';
15+
$response .= '<li data-url="' . route('report', ['slug' => $lp->slug, 'id' => Str::slug($queryId)]) . '">';
1516
$response .= '<div><i></i><span>' . $queryId . '</span></div>';
1617
$response .= '</li>';
1718
}
@@ -22,7 +23,7 @@ public static function reports($lp)
2223
private function getQueryData($slug, $id)
2324
{
2425
foreach ($this->module('queries') as $queryId => $query) {
25-
if (str_slug($queryId) == $id) {
26+
if (Str::slug($queryId) == $id) {
2627
if (env('DB_CONNECTION') == 'mysql') $set = DB::select('SET SESSION group_concat_max_len = 1024000');
2728
if (is_array($query)) {
2829
$data = DB::select($query['query']);

src/UserCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Console\Command;
66
use App\User;
7+
use Str;
78

89
class UserCommand extends Command
910
{
@@ -40,7 +41,7 @@ public function __construct()
4041
public function handle()
4142
{
4243
$user = User::where('email', $this->arguments()['email'])->first();
43-
$password = str_random(40);
44+
$password = Str::random(40);
4445
echo 'User ' . $this->arguments()['email'] . ' ';
4546
if ($user) {
4647
echo 'updated with ';

0 commit comments

Comments
 (0)