1. Go to this page and download the library: Download rush-app/core 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/ */
class Post extends RushApp\Core\Models\BaseModel
{
use HasFactory;
protected $fillable = [
'published',
'published_at',
'user_id',
];
protected $dates = [
'published_at',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}
class PostTranslation extends RushApp\Core\Models\BaseModel
{
use HasFactory;
protected $fillable = [
'title',
'description',
'post_id',
'language_id',
];
public $timestamps = false;
}
class PostController extends RushApp\Core\Controllers\BaseController
{
// The name of the model must be indicated in each controller
protected string $modelClassController = Post::class;
// FormRequest class for validation store process.
protected ?string $storeRequestClass = StorePostRequest::class;
// FormRequest class for validation update process.
protected ?string $updateRequestClass = UpdatePostRequest::class;
// Relations of model that can be attached to response (available for 'index' and 'show' method).
// NOTE: this names should be the same with method in model (Eloquent relations).
protected array $withRelationNames = [
'user',
];
}