Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Overriding and Extending

Tyler King edited this page Jun 8, 2018 · 13 revisions

Controllers & Routes

Because our provider is loaded before the app providers, you're free to use your routes/web.php to override routes.

To override the homepage route to point to your controller you can add the following to routes/web.php:

Route::get(
    '/',
    'App\Http\Controllers\HomeController@index'
)->middleware('auth.shop')->name('home');

/ will now point to your HomeController where you can return your own code/view or optionally extend \OhMyBrew\ShopifyApp\Controllers\HomeController or extend the trait. For a list of traits see src/ShopifyApp/Traits directory of this repository.

If you're overriding routes, be sure to open config/app.php and move this package's provider to be after Laravel's provider. Example:

App\Providers\RouteServiceProvider::class,
\OhMyBrew\ShopifyApp\ShopifyAppProvider::class,

Views

If you wish to simply change a view in this package, such as the layout file...

Laravel will look for views in resources/views/vendor/shopify-app. To override the layout view you would create resources/views/vendor/shopify-app/layouts/default.blade.php.

Models

You can create Shop.php in App folder and extend the package's model.

<?php

use OhMyBrew\ShopifyApp\Models\Shop as BaseShop;

class Shop extends BaseShop
{
    protected $table = 'shops';

    // Your extensions or changes
}

Important: Open config/shopify-app.php and change shop_model to point to your own shop model, or set the path to the SHOPIFY_SHOP_MODEL environment variable.

Example:

'shop_model' => '\App\Shop' // or env('SHOPIFY_SHOP_MODEL') and change .env to point to it

Welcome to the wiki!

Please see the homepage for a list of relevant pages.

Clone this wiki locally