/**
  * Get the services provided by the provider.
  *
  * @return array
  */
 public function boot()
 {
     Channel::saved(function ($channel) {
         $channels = var_export(Channel::all()->toArray(), true);
         file_put_contents(config_path() . "/content-entry.php", "<?php return {$channels};");
     });
     Channel::deleted(function ($channel) {
         $channels = var_export(Channel::all()->toArray(), true);
         file_put_contents(config_path() . "/content-entry.php", "<?php return {$channels};");
     });
     Entry::saved(function ($entry) {
         $channel = Channel::findOrFail($entry->channel_id);
         event("{$channel->name}.saved");
     });
     Entry::deleted(function ($entry) {
         $channel = Channel::findOrFail($entry->channel_id);
         event("{$channel->name}.deleted");
     });
     $this->publishes([__DIR__ . '/../../../config/content-entry.php' => config_path('content-entry.php')]);
     $this->publishes([__DIR__ . "/../../..//migrations" => database_path('migrations')], 'migrations');
 }
示例#2
0
 /**
  * Build The Content
  */
 public function __construct(array $config)
 {
     $this->channelConfig = collect($config);
     $this->channelSchema = Channel::all();
     $this->channel = new Channel();
 }