Releases: BinarCode/laravel-restify
8.0.0
Added
- Support for Laravel 10 #540
- Introduces a new option to publish specific auth actions #551
- Take actionable fields into account when calling patch method #547
- Custom namespaces support #549
- New
artisan restify:routes
comment - Updated the documentation https://restify.binarcode.com/
- 💯 - 💯 - 💯 - 💯
Improved
- Larastan specs
7.11.0
7.10.11
7.10.4
7.10.3
7.10.2
7.10.1
7.10.0
Inspired and thanks to Marcel for the article: https://beyondco.de/blog/ai-powered-error-solutions-for-laravel
Generate solution
Restify can generate an AI based solution to your problem. In order to enable that you need to extend the App\Exceptions\Handler
with the Binaryk\LaravelRestify\Exceptions\RestifyHandler
:
use Binaryk\LaravelRestify\Exceptions\RestifyHandler;
use Throwable;
class Handler extends RestifyHandler
{
//...
}
This feature is using the openai-php/laravel, you should also publish the config file:
php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"
and set the OPENAI_API_KEY
in the .env
file.
The OpenAI key can be obtained from here.
Now the solution to your problems will automatically appear in the response:
{
"restify-solution": "Line 67 in DocumentRepository.php file has an error because the method `resolveUsingFullPath()` is not defined. The code should look like this:\n```\n->resolveUsingTemporaryUrl($request->boolean('temporary'))\n```\n",
"message": "Call to undefined method Binaryk\\LaravelRestify\\Fields\\File::resolveUsingFullPath()",
"exception": "Error",
"file": "/Users/eduardlupacescu/Sites/binarcode/erp/app/Restify/DocumentRepository.php",
"line": 67,
"trace": [
...
}
Disable solution
If you want to disable the solution feature you can set the restify.ai_solution
to false
in the config/restify.php
file so Restify will not call the OpenAI API even you extended the exception handler. This might be useful in automated tests or other environments:
// config/restify.php
'ai_solutions' => true,
7.9.0
Added
Customizing File Display
By default, Restify will display the file's stored path name. However, you may customize this behavior.
Displaying temporary url
For disks such as S3, you may instruct Restify to display a temporary URL to the file instead of the stored path name:
field('path')
->file()
->path("documents/".Auth::id())
->resolveUsingTemporaryUrl()
->disk('s3'),
The resolveUsingTemporaryUrl
accepts 3 arguments:
-
$resolveTemporaryUrl
- a boolean to determine if the temporary url should be resolved. Defaults totrue
. -
$expiration
- A CarbonInterface to determine the time before the URL expires. Defaults to 5 minutes. -
$options
- An array of options to pass to thetemporaryUrl
method of theIlluminate\Contracts\Filesystem\Filesystem
implementation. Defaults to an empty array.
Displaying full url
For disks such as public
, you may instruct Restify to display a full URL to the file instead of the stored path name:
field('path')
->file()
->path("documents/".Auth::id())
->resolveUsingFullUrl()
->disk('public'),
Fixed
- fix: fixing dynamic user class
7.8.0
Added
- Now you can add a placeholder to the filter, so it renders on the frontend
'title' => MatchFilter::make()
->setDescription('Sort by title')
->setPlaceholder('-title')
->setType('string')
When we read match filters using: `/api/restify/posts/filters?only=matches` we will get:
[
"type" => "string"
"advanced" => false
"title" => "Title"
"description" => "Sort by title"
"placeholder" => "-title"
"column" => "title"
"key" => "matches"
]
Fixed
- Tests (thanks @arthurkirkosa)