-
-
Notifications
You must be signed in to change notification settings - Fork 373
Overriding and Extending
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
, example:
# Assumes you have a controller called "HomeController" (App\Http\Controllers\HomeController)
Route::get(
'/',
'HomeController@index'
)->middleware(['auth.shop', 'billable'])->name('home');
/
will now point to your own controller HomeController
. Now, you can add your own methods/views. Keep in mind, to extend the base layout as it contains all ESDK setup, example: @extends('shopify-app::layouts.default')
.
If you're overriding routes, be sure to open config/app.php
and move this package's provider to be before Laravel's provider. Example:
\OhMyBrew\ShopifyApp\ShopifyAppProvider::class,
App\Providers\RouteServiceProvider::class,
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
.
You can create Shop.php
in App
folder and extend the package's model.
<?php
namespace App;
use OhMyBrew\ShopifyApp\Models\Shop as BaseShop;
class Shop extends BaseShop
{
protected $table = 'shops';
// Your extensions or changes
}
You may also simply use the trait such as:
<?php
use OhMyBrew\ShopifyApp\Traits\ShopModelTrait;
class Shop
{
use ShopModelTrait;
// Your extensions or changes here
}
But beware, you must also copy over the model properties from OhMyBrew\ShopifyApp\Models\Shop
for Eloquent to properly work with the model.
Important: In either case, you should 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
road map
Welcome to the wiki!
Please see the homepage for a list of relevant pages.