Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/Commands/Refresh.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Binaryk\LaravelRestify\Commands;

use Illuminate\Console\Command;

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

/**
* The console command description.
*
* @var string
*/
protected $description = 'Clear all laravel caches (routes, cache, config and view)';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->call('route:cache');
$this->call('cache:clear');
$this->call('config:cache');
$this->call('view:clear');
$this->call('optimize');
}
}
2 changes: 2 additions & 0 deletions src/LaravelRestifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Binaryk\LaravelRestify\Commands\BaseRepositoryCommand;
use Binaryk\LaravelRestify\Commands\CheckPassport;
use Binaryk\LaravelRestify\Commands\PolicyCommand;
use Binaryk\LaravelRestify\Commands\Refresh;
use Binaryk\LaravelRestify\Commands\RepositoryCommand;
use Binaryk\LaravelRestify\Commands\SetupCommand;
use Binaryk\LaravelRestify\Http\Middleware\RestifyInjector;
Expand All @@ -24,6 +25,7 @@ public function boot()
SetupCommand::class,
PolicyCommand::class,
BaseRepositoryCommand::class,
Refresh::class,
]);
$this->registerPublishing();

Expand Down
4 changes: 4 additions & 0 deletions src/Repositories/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public function model()
*/
public static function uriKey()
{
if (property_exists(static::class, 'uriKey') && is_string(static::$uriKey)) {
return static::$uriKey;
}

return Str::plural(Str::kebab(class_basename(get_called_class())));
}

Expand Down