PHP code example of webbundels / models
1. Go to this page and download the library: Download webbundels/models 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/ */
webbundels / models example snippets
[attribute-1 => value, attribute-2 => value]
[attribute-1 => value, attribute-2 => value]
[
[attribute-1 => value, attribute-2 => value], // Model-1
[attriute-1 => value, attribute-2 => value] // Model-2
]
public function scopeFilter($query, $filters = [])
{
$query = parent::scopeFilter($query, $filters);
if (array_key_exists('title_contains', $filters) {
$query = $query->where('title', 'like', '%' . $filters['title_contains'] . '%');
}
return $query;
}
$webbundelsPosts = Post::filter(['title_contains' => 'Webbundels'])->get();
$webbundelsPosts = App::make('PostService')->get(['title_contains' => 'Webbundels']);
App::make('PostService')->getById(1, ['comments' => ['created_at_is_greater_than' => '2019-01-01']]);
$post = App::make('PostService')->getById(1, ['countComments' => ['created_at_is_greater_than' => '2019-01-01']]);
echo $post->comments_count;
$post = App::make('PostService')->getById(1, [
'comments' => ['created_at_is_greater_than' => '2019-01-01']
'comments.likes' => ['likes' => ['user_id_is' => 1337]]
]);
$post = App::make('PostService')->getById(1, [
'comments' => [
'created_at_is_greater_than' => '2019-01-01'
'likes' => ['user_id_is' => 1337]
]
'comments.likes' => ['likes' => ['user_id_is' => 1337]]
]);
php artisan wb:make:model-service #Modelname
php artisan wb:make:repository #Modelname
php artisan wb:make:model #Modelname
php artisan wb:make:model-classes #Modelname