add nova
This commit is contained in:
30
nova/src/Actions/ActionMethod.php
Normal file
30
nova/src/Actions/ActionMethod.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Nova\Actions;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ActionMethod
|
||||
{
|
||||
/**
|
||||
* Determine the appropriate "handle" method for the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Actions\Action $action
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @return string
|
||||
*/
|
||||
public static function determine(Action $action, $model)
|
||||
{
|
||||
if (! is_null($action->handleCallback)) {
|
||||
return 'handleUsingCallback';
|
||||
}
|
||||
|
||||
$method = 'handleFor'.Str::plural(class_basename($model));
|
||||
|
||||
if (method_exists($action, $method)) {
|
||||
return $method;
|
||||
}
|
||||
|
||||
return 'handle';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user