viart/dashboard

Dashboard for Laravel

dev-main 2022-01-20 14:12 UTC

This package is auto-updated.

Last update: 2024-03-12 18:40:32 UTC


README

logo.png

Dashboard

Dashboard panel for Laravel project.

dashboard-1.jpg?raw=true dashboard-2.jpg?raw=true dashboard-3.jpg?raw=true

Install

  1. Installation via Composer
composer require viart/dashboard
  1. Install dashboard scaffolding
php artisan dashboard:install
  1. Exception

  2. dashboard 404

  3. RedirectIfAuthenticated make duplicate. add check on already exist

  4. MenuSeeder make duplicate. fix it

Documentation

Improve app

  1. Add db string limited
namespace App\Providers;

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }
}
  1. RouteServiceProvider uncomment
protected $namespace = 'App\\Http\\Controllers';
  1. Add response and pass csrf token to front
<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Coderello\SharedData\Facades\SharedData;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        SharedData::put([
            'csrf' => csrf_token(),
        ]);
    }

    /**
     * Returns REST response
     *
     * @param array|integer $error Error Code or array of params
     * @param array|null $params Array of additional params
     *
     * @return REST array
     */
    protected function response($params = array()) {
        $response = Arr::only($params, [ERR, CODE, MSG, DATA]);
        if (!isset($response[ERR])) {
            $response[ERR] = Response::HTTP_OK;
        }
        return $response;
    }
}

Possible troubleshooting

Fatal error: Allowed memory size of 1610612736 bytes exhausted

COMPOSER_MEMORY_LIMIT=-1 composer require viart/dashboard

Class 'Dashboard\Providers\DashboardServiceProvider' not found

call command bellow and rerun composer require viart/dashboard again

rm -f bootstrap/cache/*.php

No application encryption key has been specified.

php artisan key:generate