PHP code example of tarik02 / laravel-mixin
1. Go to this page and download the library: Download tarik02/laravel-mixin 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/ */
tarik02 / laravel-mixin example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\Article
*
* @property int $id
* @property string $title
* @property string $description
* @property string $text
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
*/
abstract class Article extends Model
{
//
}
namespace App\Providers;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\ServiceProvider;
class MixinServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$mixin = $this->app->make('mixin');
$mixin
->register(\Models\Article::class, \App\Models\Article::class)
->mixTrait(SoftDeletes::class)
;
$mixin
->class(\Models\Article::class)
->mixInterface(MyInterface::class)
;
}
}
+ App\Providers\MixinServiceProvider::class,
App\Providers\AppServiceProvider::class,
namespace Models;
use App\Models\Article as Base;
class Article
extends Base
{
use \Illuminate\Database\Eloquent\SoftDeletes;
}