
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Contracts\Foundation\Application;
|
|
use Illuminate\Contracts\View\Factory;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\Response;
|
|
|
|
class SettingsController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return Application|Factory|View|Response
|
|
*/
|
|
public function index()
|
|
{
|
|
//Get all tabs as laravel view paths
|
|
$tabs = [];
|
|
foreach (glob(resource_path('views/admin/settings/tabs/*.blade.php')) as $filename) {
|
|
$tabs[] = 'admin.settings.tabs.'.basename($filename, '.blade.php');
|
|
}
|
|
|
|
//Generate a html list item for each tab based on tabs file basename, set first tab as active
|
|
$tabListItems = [];
|
|
foreach ($tabs as $tab) {
|
|
$tabName = str_replace('admin.settings.tabs.', '', $tab);
|
|
$tabListItems[] = '<li class="nav-item">
|
|
<a class="nav-link '.(empty($tabListItems) ? 'active' : '').'" data-toggle="pill" href="#'.$tabName.'">
|
|
'.__(ucfirst($tabName)).'
|
|
</a></li>';
|
|
}
|
|
|
|
return view('admin.settings.index', [
|
|
'tabs' => $tabs,
|
|
'tabListItems' => $tabListItems,
|
|
]);
|
|
}
|
|
}
|