<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eloverde-sistemas / laravel-crud-builder example snippets
use CrudBuilder\CrudBuilder;
$singer = CrudBuilder::for(Singer::class)
->allowedAttributes('age', 'name')
->create();
//A singer is created in database with the request data
use CrudBuilder\CrudBuilder;
$singer = CrudBuilder::for(Singer::class)
->allowedAttributes('age', 'name')
->update();
//A singer with the requested id is updated in database with the request data
use CrudBuilder\CrudBuilder;
$singer = CrudBuilder::for(Singer::class)
->ignoreAttributes('age', 'surname')
->allowedAttributes('name')
->update();
//A singer with the requested id is updated in database with the request data, except the ignored attributes
class SingerModel extends Model
{
public function band()
{
return $this->belongsTo(Band::class);
}
}
use CrudBuilder\CrudBuilder;
$singer = CrudBuilder::for(Singer::class)
->allowedAttributes('name')
->allowedRelations('band')
->update();
//A singer with the requested id is updated in database with the request data, including the relationship
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.