Skip to content

Commit

Permalink
feat: update new rule stub
Browse files Browse the repository at this point in the history
  • Loading branch information
hungthai1401 committed Oct 24, 2023
1 parent 4d40dc3 commit 5e12aee
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 90 deletions.
25 changes: 5 additions & 20 deletions src/Commands/stubs/rule.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,16 @@

namespace $NAMESPACE$;

use Illuminate\Contracts\Validation\Rule;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class $CLASS$ implements Rule
class $CLASS$ implements ValidationRule
{
/**
* Create a new rule instance.
* Run the validation rule.
*/
public function __construct()
public function validate(string $attribute, mixed $value, Closure $fail): void
{
//
}

/**
* Determine if the validation rule passes.
*/
public function passes(string $attribute, $value): bool
{
//
}

/**
* Get the validation error message.
*/
public function message(): string
{
return 'The validation error message.';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MyController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -27,7 +27,7 @@ class MyController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -37,7 +37,7 @@ class MyController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -47,7 +47,7 @@ class MyController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -57,6 +57,6 @@ class MyController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BlogController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -27,7 +27,7 @@ class BlogController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -37,7 +37,7 @@ class BlogController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -47,7 +47,7 @@ class BlogController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}

/**
Expand All @@ -57,6 +57,6 @@ class BlogController extends Controller
{
//

return response()->json($this->data)->setStatusCode(200);
return response()->json($this->data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,16 @@

namespace Modules\Blog\SuperRules;

use Illuminate\Contracts\Validation\Rule;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class UniqueRule implements Rule
class UniqueRule implements ValidationRule
{
/**
* Create a new rule instance.
* Run the validation rule.
*/
public function __construct()
public function validate(string $attribute, mixed $value, Closure $fail): void
{
//
}

/**
* Determine if the validation rule passes.
*/
public function passes(string $attribute, $value): bool
{
//
}

/**
* Get the validation error message.
*/
public function message(): string
{
return 'The validation error message.';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,16 @@

namespace Modules\Blog\SuperRules;

use Illuminate\Contracts\Validation\Rule;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class UniqueRule implements Rule
class UniqueRule implements ValidationRule
{
/**
* Create a new rule instance.
* Run the validation rule.
*/
public function __construct()
public function validate(string $attribute, mixed $value, Closure $fail): void
{
//
}

/**
* Determine if the validation rule passes.
*/
public function passes(string $attribute, $value): bool
{
//
}

/**
* Get the validation error message.
*/
public function message(): string
{
return 'The validation error message.';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,16 @@

namespace Modules\Blog\Rules;

use Illuminate\Contracts\Validation\Rule;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class UniqueRule implements Rule
class UniqueRule implements ValidationRule
{
/**
* Create a new rule instance.
* Run the validation rule.
*/
public function __construct()
public function validate(string $attribute, mixed $value, Closure $fail): void
{
//
}

/**
* Determine if the validation rule passes.
*/
public function passes(string $attribute, $value): bool
{
//
}

/**
* Get the validation error message.
*/
public function message(): string
{
return 'The validation error message.';
}
}

0 comments on commit 5e12aee

Please sign in to comment.