Taste Page
new taste page
Category: Laravel | Comments: 0new taste page
Category: Laravel | Comments: 0Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Category: Laravel | Comments: 1composer create-project --prefer-dist laravel/laravel blogf
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=here database name here
DB_USERNAME=here database username here
DB_PASSWORD=here database password here
cd blog
composer require laravel/ui --dev
php artisan ui vue --auth
php artisan make:model Post -fm
Open create_posts_table.php migration:
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('title');
$table->string('slug');
$table->unsignedBigInteger('user_id');
$table->timestamps();
});
}
php artisan migrate
Navigate to app/Models/Post.php:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasFactory;
protected $guarded = [];
}
Factory
Navigate to database/factories and open PostFactory.php:
public function definition()
{
$title = fake()->sentence();
$slug = Str::slug($title);
return [
'title' => $title,
'slug' => $slug,
'user_id' => 1
];
}
php artisan tinker
//and then
App\Models\User::factory()->count(10)->create();
App\Models\Post::factory()->count(30)->create();
exit
Category: Laravel | Comments: 2