Git Product home page Git Product logo

voyager-frontend's Introduction

Voyager Frontend

Voyager Frontend Screenshot

The Missing Frontend for The Missing Laravel Admin.

This Laravel package adds frontend views, routes and assets to a Voyager project.

It comes with a basic structure for frontend layouts (eg. header, footer, etc) and theme assets using the Foundation framework.

Built by Pivotal Agency.


Prerequisites


Installation

# 1. Require this Package in your fresh Laravel/Voyager project
composer require pvtl/voyager-frontend

# 2. Run the Installer
composer dump-autoload && php artisan voyager-frontend:install

# 3. Build the front-end theme assets
npm run dev

Any issues? See the troubleshooting section below.


Theme Development

SCSS & JS

When you're ready to start styling your frontend, you can use the following commands after making updates to SCSS and/or JS files:

Command Description
npm run watch Watches your /resources/assets for any changes and builds immediately
npm run dev Builds SCSS/JS on demand
npm run prod Builds SCSS/JS on demand, but this time, outputs minified results

Overriding Views

Let's say you want to update the layout of the frontend header:

  1. Create the directory resources/views/vendor/voyager-frontend
    • Any files you place in here will replace the default views that comes with this package
  2. Copy the respective file from vendor/pvtl/voyager-frontend/resources/views/ (in this case, the partials/header.blade.php) into the matching file structure and update

So now you'll have:

    /resources
        /views
            /vendor
                /voyager-frontend
                    /partials
                        /header.blade.php

And any changes made to header.blade.php reflect automatically on the site.


Search

Generating Indices

This module contains a scheduled job to regenerate indices which will run automatically once you setup jobs for Laravel. If you need to test and re-generate search indices you can manually run the command php artisan search-indices:generate.

Configuring Search (Using Laravel Scout)

By default this module includes "searching" the "Pages" and "Posts" Models out-of-the-box once you have defined the following variable in your .env file - check out the Laravel Scout documentation:

SCOUT_DRIVER=tntsearch

You can however extend and define your own "Searchable" Models to include in your search results by attaching the "Searchable" trait to them.

class Page extends Model
{
    use Searchable;

    public $asYouType = false;

    /**
     * Get the indexed data array for the model.
     * @return array
     */
    public function toSearchableArray()
    {
        $array = $this->toArray();

        // customise the searchable array
        
        return $array
    }
}

Then you'll be able to hook into the search config and merge your "Searchable" Models in with the config key (preferably using a Servie Provider): scout.tntsearch.searchableModels.

$this->mergeConfigFrom(self::PACKAGE_DIR . 'path/to/config/scout.php', 'scout.tntsearch.searchableModels');

Your configuration file should contain values similar to this modules scout.php configuration:

<?php

return [
    '\My\Searchable\Models\Namespace',
];

Testing

You can test the Pvtl/Test package switching to the packages directory and running tests via composer scripts:

  cd packages/pivotal/test;
  composer run test

Toubleshooting

Error: Class VoyagerFrontendDatabaseSeeder does not exist

Simply run php artisan voyager-frontend:install again

Error: The command "npm i ..." failed.

Run npm install and then try php artisan voyager-frontend:install again

voyager-frontend's People

Contributors

mcnamee avatar jean-pierregassin avatar superhaggis avatar

Watchers

James Cloos avatar Fernando Alvarez Buylla avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.