1. Go to this page and download the library: Download takielias/lab library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
function store(SaveProductRequest $saveProductRequest)
{
$validated = $saveProductRequest->validated();
Product::create($validated);
return Lab::setData(['success' => true])
->enableScrollToTop()
->setRedirect(route('product.index'))
->setSuccess('Product Created Successfully')
->setStatus(201)
->toJsonResponse();
}
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Takielias\Lab\Facades\Lab;
class SaveProductRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'price' => ['
`bash
php artisan lab:install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.