Code Monkey home page Code Monkey logo

docs's Introduction

Documentation for Laravel Tenancy

These are the source files used on laravel-tenancy.com.

These files use YAML frontmatter, which means a docs files can have a YAML based meta section followed by a CommonMark markdown string.

---
title: Some title
tags:
    - important
---
Welcome to code and other **markdown**.

The docs are all categorized based on their packages and versions. Currently the docs supports hyn/multi-tenant and the upcoming tenancy/tenancy packages.

In order to create a navigation element, the tree of these documentations are specified in the meta file docs.yaml.

docs's People

Contributors

aaronfahey avatar arlonantonius avatar ashokgelal avatar bkintanar avatar bradenkeith avatar connysjoblom avatar drbyte avatar fletch3555 avatar janiskelemen avatar jeremyj11 avatar jeslabbert avatar johannesschobel avatar juhasev avatar kenlewis avatar lioneaglesolutions avatar luceos avatar markkimsal avatar martijnthomas avatar mdixon18 avatar mrchick avatar netcom avatar paulohenriquesg avatar paulotra avatar plytas avatar rizkhal avatar sniper7kills avatar soskr avatar tobeycodes avatar tofandel avatar xalunda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs's Issues

[$ 200] Voyager integration

There's an increasing demand for decent tutorials explaining how to integrate the Laravel Voyager admin dashboard with hyn/multi-tenant. Such a tutorial would require at least:

  • how to set up the default laravel app
  • install both packages
  • explain how to use tenant/system behavior with voyager in depth
  • provide demo repository

Make sure you open a WIP PR as soon as possible (subject of PR needs to start with WIP), indicating your interest in closing this issue and taking a shot at the $ 200 reward. The reward will be given to the best tutorial at the end of this month or thereafter and only with the approval of at least two staff members.

The full tutorial has to be a PR against the docs, not just the link ;) This way we can update it for newer versions too without having to coerce the original author into oblivion..

Also:

  • you can add the link the new page here
  • and feel free to attach your meta information in the YAML frontmatter like so, I'll make sure we'll link the author again the docs, nevertheless your contribution is under our contributor guidelines

Using Storage::class per tenant (Media)

Moved from tenancy/multi-tenant#318

I was struggling with retrieving media from Tenant storage. Since i wasn't using the (Nginx) webserver integration, i had to mimic this behavior.

Description
When retrieving files from storage, by default you fetch the system storage directory. If you like to call upon Tenant specific storage, you can solve this by e.g. a Route definition like this:

Route::get('/media/{filename}', function ($filename)
{
    return Storage::disk('tenant')->get("media/{$filename}");
});

Information

  • hyn/multi-tenant version: 5.0*
  • laravel version: 5.5
  • database driver and version: Mysql
  • webserver software and version: Nginx
  • php version: 7+

tenancy.php config

'media' => [
            /**
             * Mounts the assets directory with (static) files for public use.
             */
            'enabled' => true,
        ]

Documentation - Omitted !

https://tenancy.dev/docs/tenancy/1.x/hooks-hostname#hook

public function handle(Event $event): void
    {
        if($this->hasValidDomains($event->tenant)){
        Mail::to($event->tenant->email)->send(new DomainsNotValid($event->tenant->getHostnames()));
        }
    }

Exclamation mark was omitted in the if condition above.

It should be : if(!$this->hasValidDomains($event->tenant))

According to the documentation:
"If the tenant does not have valid domains, we will send an email to the administrator regarding the domains not being valid."

Create tutorial for Laravel passport implementation

Moved from tenancy/multi-tenant#348

I'd like to see a practical step by step tutorial how you can implement Laravel passport like this:

  • all tenant websites of one customer can authenticate via one specific tenant website
    This requires you to replace the customer model and register the passport server url.

A tutorial of good quality can expect a months patron donations to be paid in return. Contact me on chat for details.

Spatie backup command

Moved from tenancy/multi-tenant#354

Thanks to @Thijmen

We need to add this to the documentation.

<?php

namespace App\Console\Commands;

use Hyn\Tenancy\Database\Connection;
use Hyn\Tenancy\Models\Website;
use Illuminate\Console\Command;

class BackupCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:backup';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Backup all the tenants and system';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->backupSystem();
        $sites = Website::all();
        foreach ($sites as $site) {
            $this->setupConfigForSite($site);
            $this->callBackupCommand();
        };
    }

    protected function backupSystem()
    {
        \Config::set('backup.backup.source.databases', ['system']);
        \Config::set('backup.backup.name', 'system-backup');
        $this->call('backup:run', ['--only-db']);
    }

    protected function setupConfigForSite(Website $website)
    {
        $connection = app(Connection::class);
        $connection->set($website);
        \Config::set('backup.backup.source.databases', ['tenant']);
        \Config::set('backup.backup.name', 'tenant-' . $website->uuid);
        \Config::set('backup.backup.source.files.include', $this->siteIncludes($website));
    }
    

    protected function siteIncludes(Website $website)
    {
        return storage_path('app/tenancy/tenants/' . $website->uuid);
    }

    protected function callBackupCommand()
    {
        $this->call('backup:run');
    }
}

Revisit Documentation

Moved from tenancy/multi-tenant#422

I think the documentation is somewhat behind already. There's a need to revisit the entire documentation and check all pages for what is still working and what new things needed to be added.

Getting Started

Tenant Principles

Implementation

Webserver

Tutorials

Password reset table on tenant database

Moved from tenancy/multi-tenant#443

It's possible to force the password reset entries to be saved on the tenant connection. In order to do so update the auth.php file and add the connection key like this:

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'connection' => 'tenant',
        ],
    ],

Suggested version should be a global js var

Currently both layout and home vue components rely on hard-coded versions to "get started" with. This value should be identified from php from the logic that caches packages, versions so that inside the loop a new cache key is created permanently that holds just the package slug and version slug of the suggested version. We can then assign the value to Javascript from inside the frontend controller.

Explain how to set up a queue with elevated permissions

Moved from tenancy/multi-tenant#347

Description

The php script to create a new tenant website reports the following error:

The command "/etc/init.d/nginx configtest" failed.

Exit Code: 1(General error)

Working directory: /home/vagrant/Code/cff/public

Output:

================

  • Testing nginx configuration
    ...fail!

Error Output:

================

Actual behavior
The tenant database has been created, including the tenant folder and the tenant nginx .config file. However the nginx .config file is not complete:

Here are the contents of the file:

Auto generated Apache configuration
@author: hyn/multi-tenant
@see: http://laravel-tenancy.com
@time: 14:29:11 12-12-2017
@website id: 47
@website uuid: fb1396bbdadf445fbce6ee215f382908

   No hostnames found

that' all there is in this file.....

The remaining part of the website creation is abandoned, the hostname has not been created and the hostname is not attached to the website.

As a result, the new tenant web site cannot be accessed.

Expected behavior

..


Information

A few days ago, the code ran without any problem. After that I have upgraded to Hyn/multi-tenancy 5.0.15.

It might have something to do with access rights.

If I run "/etc/init.d/nginx configtest" manually from the command prompt, it returns an error. But if I run
"sudo /etc/init.d/nginx configtest", it reports no errors in the nginx config files.

Trying to find a solution, I added "sudo" in the webserver.php file in the nginx section like this:
original code "'test-config' => '/etc/init.d/nginx configtest',
changed code 'test-config' => 'sudo /etc/init.d/nginx configtest',

Then, this error did not occur, but the next error appeared instead:

"The command "systemctl restart nginx" failed."

Adding "sudo" to this line in the webserver.php file did not work.

  • hyn/multi-tenant version: 5.0.15
  • laravel version: 5.5
  • database driver and version: MariaDB 10.2
  • webserver software and version: nginx version: nginx/1.13.3
  • php version: 7.1
  • vagrant 2.01 with laravel/homestead (virtualbox, 5.0.1)

I have removed the laravel/homestead box completely and reinstalled a new one. That did not help either.

tenancy.php config

As attached

webserver.php config

As attached

Error log

As attached

TenantController.php: see attachment

[error.zip](https://github.com/hyn/multi-tenant/files/1552086/error.zip)

how to config the webserver.php

hello , the config is suite to linux now. i want to know how to config config/webserver.php in windows.
and any other config in windows i must ?
thank you

Documentation proposal: use another path for the migrations path example

Originally posted by @wertmenschen. Moved from tenancy/multi-tenant#277

I was a little confused by the example proposed for tenant specific migrations (https://laravel-tenancy.com/documentation/implementation/migrations): storage/app/tenancy/migrations. I usually have nothing within the storage path in my repository, but I think the migrations should belong there. So maybe something like database/tenancy/migrations (which is in the repository by default) would be a better and clearer example?

Also I was a little confused by the term "tenant specific" first - does it mean "regarding ONE specific tenant" or "regarding ALL tenants"? I know it's the latter but maybe there is some better way to say it.

Docs for affects-mails outdated?

I tried using affects-mails according to the example in the docs today.
Didn't work as expected, got an error that my mailer didn't have a setFrom() method.
I checked, the Mailer associated with my ConfigureMails event is an Illuminate\Mail\Mailer, not a Swift_Mailer.

Is the example outdated or did I do something wrong?

(tenancy/affects-mails, Laravel 7)

consistent code blocks

Some php code blocks have the starting <?php whereas others do not. I prefer not showing them, but we do need to make sure the markdown tripple backtick ends with php to enforce a specific language.

Go over all code blocks and remove <?php and make sure the backticks match.

New lines in code blocks

Mentioned this in discord, but wanted to track it here as well.

Not sure if this is a docs issue or a site/CSS issue, but code blocks aren't rendering with new-lines. All code is appearing as if it were written on a single line. Looking at the markdown source, this is clearly not intended.

Handle 404 with no package or version available

In case there's no package or package version or article we need to serve a decent 404 and give the ability to look for default pages; eg the docs page for the currently stable versions.

Packages version overview alignments

We need to improve the alignments and overall layout of the docs landing page. The design also shows more features than those we currently provide: https://laravel-tenancy.com/docs

What needs to be done:

  • Increase priority of current stable (recommended) version @paulotra any suggestions for that?
  • Align version text inside buttons
  • Fix size of button for version; now each version has different sizes due to the stability labels.
  • Show graph; for this to work we need to add the stargazer history to the PackageTransformer.
  • Show repository star count, also needs this to be added to the transformer.
  • Show package downloads stats.

image

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.