1. Go to this page and download the library: Download stillat/relationships library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stillat / relationships example snippets
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'conferences.sponsored_by',
'sponsors.sponsoring'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'user:managing_conferences',
'conferences.managed_by'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'term:topics.posts',
'posts.topics'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'conferences.sponsored_by',
'sponsors.sponsoring'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'term:categories.field_name',
'entry:{collection1,collection2,collection3,collection4}.field_name'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'term:categories.field_name',
'entry:collection1.field_name'
);
Relate::manyToMany(
'term:categories.field_name',
'entry:collection2.field_name'
);
Relate::manyToMany(
'term:categories.field_name',
'entry:collection3.field_name'
);
Relate::manyToMany(
'term:categories.field_name',
'entry:collection4.field_name'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::oneToMany(
'books.author',
'authors.books'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToOne(
'authors.books',
'books.author'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::oneToOne(
'employees.position',
'positions.filled_by'
);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::manyToMany(
'conferences.sponsored_by',
'sponsors.sponsoring'
)->allowDelete(false)->withEvents(true);
}
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Stillat\Relationships\Support\Facades\Relate;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Relate::collection('conferences')
->field('sponsored_by')
->isRelatedTo('sponsors')
- >through('sponsoring')
->manyToMany();
}
}
bash
php please relate:list collection
bash
php please relate:fill collection
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.