PHP code example of milenmk / laravel-livewire-crud
1. Go to this page and download the library: Download milenmk/laravel-livewire-crud 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/ */
milenmk / laravel-livewire-crud example snippets
declare(strict_types=1);
namespace App\Livewire\Client;
use App\Livewire\CommonComponent;
use App\Models\Client;
use Milenmk\LaravelCrud\GetSetData;
final class Clients extends CommonComponent
{
use GetSetData;
// Store new client
public function storeClient(): void
{
$this->rules = [
'company' => '/ Edit existing client
public function editClient(int $clientId): void
{
$this->commonEditData('Client', $clientId);
}
// Update client information
public function updateClient(): void
{
$this->rules = [
'company' => '$this->commonDestroyData('Client');
}
// Bulk delete clients
public function bulkDestroyClients(): void
{
$this->commonBulkDestroyData('Client', $this->selectedItems);
}
/**
* Array of selected items for bulk action
*/
public array $selectedItems = [];
}
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Models\Client;
use Milenmk\LaravelCrud\GetSetData;
class ClientController extends Controller
{
use GetSetData;
public function storeClient(): void
{
$this->rules = [
'company' => ' ];
$this->commonStoreData('Client');
}
public function editClient(int $clientId): void
{
$this->commonEditData('Client', $clientId);
}
public function updateClient(): void
{
$this->rules = [
'company' => ' 'status' => '
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.