Skip to content

Instantly share code, notes, and snippets.

View dominiquevienne's full-sized avatar

Dominique Vienne dominiquevienne

  • Gloomy Spark
  • Montricher, Suisse
View GitHub Profile
@dominiquevienne
dominiquevienne / AddedFillable_BlogPost.php
Last active January 11, 2022 15:10
Updated $fillable in order to fill title, content and authorName
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class BlogPost extends Model
{
use HasFactory;
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBlogPostsTable extends Migration
{
/**
* Run the migrations.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBlogPostsTable extends Migration
{
/**
* Run the migrations.
@dominiquevienne
dominiquevienne / artisan_make_blogpost_model.sh
Created December 17, 2021 08:50
Laravel - Create a BlogPost model with its migration file
$ php artisan make:model BlogPost -m
Model created successfully.
Created Migration: 2021_12_17_084953_create_blog_posts_table
@dominiquevienne
dominiquevienne / 2021_12_16_070817_update_users_add_born.php
Created December 16, 2021 07:11
Laravel - Migration file - Sample - Adding a born_at property
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateUsersAddBorn extends Migration
{
/**
* Run the migrations.
@dominiquevienne
dominiquevienne / laravel_userfactory.php
Created December 15, 2021 13:54
Laravel - UserFactory part
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
APP_NAME="My New Application name"
APP_ENV=local
APP_KEY=base64:J4sHZyCJi+MQ9xJ7e4c3J+QQvpSI8GTbfe76a1T/NQE=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
@dominiquevienne
dominiquevienne / laravel_config_file_never_hardcode_env_values.php
Created December 15, 2021 13:43
Laravel - Do not edit env values directly in code
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
@dominiquevienne
dominiquevienne / Laravel_config_file_example_env.php
Last active December 15, 2021 13:40
Laravel config file example
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
@dominiquevienne
dominiquevienne / laraval8_composer_sample_output.sh
Created December 14, 2021 10:44
Laravel 8 - Composer Sample output on installation
Creating a "laravel/laravel" project at "./learn-laravel"
Installing laravel/laravel (v8.6.9)
- Downloading laravel/laravel (v8.6.9)
- Installing laravel/laravel (v8.6.9): Extracting archive
Created project in /home/dvienne/Documents/Projects/learn-laravel
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 110 installs, 0 updates, 0 removals
- Locking asm89/stack-cors (v2.0.3)