Skip to content

Instantly share code, notes, and snippets.

View Cerwyn's full-sized avatar
🤩
Amazing

Cerwyn Eliata Cerwyn

🤩
Amazing
View GitHub Profile
@Cerwyn
Cerwyn / User.php
Last active April 15, 2020 02:18
One-to-one
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
@Cerwyn
Cerwyn / api.php
Last active April 15, 2020 02:17
One-to-one
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
@Cerwyn
Cerwyn / Address.php
Last active April 15, 2020 02:17
One-to-one
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Address extends Model
{
protected $fillable = [
'zip_code', 'country',
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class UserController extends Controller
<?php
namespace App\Http\Controllers;
use App\User;
use App\Address;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request;
class AddressController extends Controller
@Cerwyn
Cerwyn / create_addresses_table.php
Last active October 19, 2020 12:13
One-to-one
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
@Cerwyn
Cerwyn / create_articles_table.php
Last active April 16, 2020 06:51
One-to-many
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateArticlesTable extends Migration
{
/**
* Run the migrations.
@Cerwyn
Cerwyn / create_comments_table.php
Last active April 17, 2020 04:52
One-to-many
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
@Cerwyn
Cerwyn / Article.php
Created April 16, 2020 06:52
One-to-many
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
protected $fillable = [
@Cerwyn
Cerwyn / Comment.php
Created April 16, 2020 06:52
One-to-many
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
protected $fillable = [
'text', 'star'