This is the package I use for my Record Collection on this site. It provides a searchable HTML interface, an API interface and an administrative interface.
composer require escuccim/recordcollection
Then register the components in /config/app.php:
Add the following to the 'providers' array:
Escuccim\RecordCollection\RecordCollectionServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,
And add the following to 'aliases' array:
Run the database migrations to create the blog tables and update the users table:
php artisan migrate
To enable the JavaScript features of the search page pages you need to add the following to the head of your layouts/app.blade.php view:
<script src="/js/app.js"></script>
@stack('scripts')
Note that you must move the script tag referencing app.js from the bottom of the layout to the header to enable the Javascript features of the search and administrative screens.
You must publish the pagination and config files with:
php artisan vendor:publish --tag=config
This will publish the Javascript files used for the search page to your public directory and will place altered pagination files in your resources directory. These are all required for the search interface to function properly.
By default I use a middleware I call 'admin' to verify if the user has permission to access the administrative pages. If you wish to use this you need to register the middleware in /app/Http/Kernel.php in $routeMiddleware:
'admin' => \Escuccim\RecordCollection\Middleware\AdminMiddleware::class,
If you wish to use your own middleware or stick with Laravel's Auth middleware you can do so by updating the config (see below).
This package contains its own routes, models, controllers and views so should work after installation. To access it just go to /records.
If you wish to edit my views or other files you can publish them to your application:
php artisan vendor:publish
This will publish all of the files. To only publish certain files add --tag=[group]
, using the groups listed below:
You must publish the config group of files for the search interface to work properly. The config group includes the JavaScript files used by the search interface, and customized pagination files.
To add additional languages, publish the lang files and then create new directories under /resources/lang/vendor/record-lang corresponding to the language you wish to add. Copy the records.php file into your new directory and put the translations into the new language into the array.
Note that out of the box the blog will use the languages specified in config/app.php under 'locale'. If you wish to have the blog translate on a per request basis you will need to provide the code for this, or use my package escuccim/translate.
To access the configuration files you need to publish the config file to /config/blog.php with
php artisan vendor:publish --tag=config
.
The config file has the following values: