2017 © Pedro Peláez
 

library kobalt

Set of reusable views and code to help building small scale Laravel backends

image

hoppermagic/kobalt

Set of reusable views and code to help building small scale Laravel backends

  • Tuesday, January 2, 2018
  • by paparabbit
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

Set of admin views and functionality to speed up development of small custom Content Management Systems built in Laravel...., (*1)

Steps for using, (*2)

If it doesn't auto discover, (*3)

Config/app.php, (*4)

Hoppermagic\Kobalt\KobaltServiceProvider::class

Package will automatically add the following but you might want to add these in config.app, (*5)

Kris\LaravelFormBuilder\FormBuilderServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,

'FormBuilder' => Kris\LaravelFormBuilder\Facades\FormBuilder::class,
'Flash' => Laracasts\Flash\Flash::class,

Setup db preferences, (*6)

Run the standard laravel auth generator, (*7)

php artisan make:auth
php artisan migrate

Register yourself, disable the auth routes in web.php, (*8)

Add the non-registration routes from Router.php (auth method) to web.php, (*9)

Remember to comment out the Auth::routes(), (*10)

From 5.8 it wont show register if the route doesn't exist., (*11)

app.blade.php also contains a reference to the register route, so need to comment out, (*12)

// From 5.8?

Auth::routes(['register', false]);

OR

//!TODO MAKE SURE YOU USE THE ONES FROM ROUTER.PHP
// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');

Admin area web routes, (*13)

could put these in their own admin.php file....., (*14)

Route::group([
        'namespace' => 'Admin',
        'prefix' => 'admin',
        'as' => 'admin.']
    ,function(){

        // STORIES
        Route::get('story/{story}/confirmdel', [
            'as' => 'story.confirmdel',
            'uses' => 'StoriesController@confirmDelete'
        ]);
        Route::resource('/story', 'StoriesController', [
            'except' => ['show'],
        ]);

        // STORY IMAGES
        Route::get('story/{story}/storyimage/{storyimage}/confirmdel', [
            'as' => 'story.{story}.storyimage.{storyimage}.confirmdel',
            'uses' => 'StoryImageController@confirmDelete'
        ]);
        Route::get('/story/{story}/storyimage/createbulk', 'StoryImageController@createBulkUpload')->name('storyimage.createbulk');
        Route::post('/story/{story}/storyimage/storebulk', 'StoryImageController@storeBulkUpload')->name('storyimage.storebulk');
        Route::resource('/story/{story}/storyimage', 'StoryImageController', [
            'except' => ['show','index'],
        ]);

        // Stories ajax routes
        Route::post('story/{story}/edit/imageload', 'StoriesController@imageGalleryLoad');
        Route::post('story/{story}/edit/imagesort', 'StoriesController@imageGallerySort');
        Route::post('story/sort', 'StoriesController@overviewSort');
    }
);

Make sure the following are pointing to the admin homepage, (*15)

Controllers\Auth\LoginController, (*16)

Controllers\Auth\RegisterController, (*17)

Controllers\Auth\ResetPasswordController, (*18)

Middleware\RedirectIfAuthenticated, (*19)

protected $redirectTo = '/admin/overviewpage'; // Admin landing page

Css and Js links in admin template, (*20)

app.blade.php, (*21)

<link href="{{ asset('css/admin.css') }}" rel="stylesheet">


or


View Composer, (*22)

FYI, KobaltServiceProvider makes sure the active variable is available in the admin nav partial, its pushing in segment(2) so make sure this is what you want. Undecided if this is a good thing., (*23)

Publish assets, (*24)

admin js,, (*25)

admin enhancements - Handy place for tiny_mce setup, select2 etc, (*26)

css, (*27)

admin images, (*28)

admin nav partial, (*29)

admin template, (*30)

need to update this file with the latest structure from app.blade.php Pull in local version of tiny mce, (*31)

use force to overwrite, (*32)

after publishing amend the nav partial, (*33)

php artisan vendor:publish --provider="Hoppermagic\Kobalt\KobaltServiceProvider" --tag=default --force

Publish all admin views, (*34)

php artisan vendor:publish --provider="Hoppermagic\Kobalt\KobaltServiceProvider" --tag=admin-views --force

Publish just the css and js, (*35)

php artisan vendor:publish --provider="Hoppermagic\Kobalt\KobaltServiceProvider" --tag=css-js --force

If you need to recompile the js/css, (*36)

npm run production

Create model, admin controller, form and request, (*37)

Will create RabbitController etc, (*38)

php artisan make:ko-resources Rabbit
php artisan make:ko-controller Rabbit
php artisan make:ko-form Rabbit

//!TODO config/app.php, (*39)

//!TODO Notes about editable, deleteable, addable, (*40)

Forms, (*41)

Form Builder Static type is now escaped, so if you need to pass a view in need to use unescaped static., (*42)

$this->addCustomField('unescaped-static', 'Hoppermagic\Kobalt\Forms\Fields\UnescapedStaticType');

Form fields on desktop will be 60% width unless, (*43)

'attr' => [
    'class' => 'form-control full-width'
],

Rich text fields, (*44)

'attr' => [
    'class' => 'rich-text'
],

The Versions

02/01 2018

dev-develop

dev-develop

Set of reusable views and code to help building small scale Laravel backends

  Sources   Download

MIT

The Requires

 

by leigh kayley

06/11 2017

dev-master

9999999-dev

Set of reusable views and code to help building small scale Laravel backends

  Sources   Download

MIT

The Requires

 

by leigh kayley