PHP code example of pentacore / laravel-typefinder

1. Go to this page and download the library: Download pentacore/laravel-typefinder 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/ */

    

pentacore / laravel-typefinder example snippets


// app/Models/Post.php
class Post extends Model
{
    protected $casts = [
        'status' => PostStatus::class,
        'published_at' => 'datetime',
    ];

    public function author(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}
bash
php artisan typefinder:generate