This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use App\Http\Controllers\Controller; | |
class PostController extends Controller | |
{ | |
public function store(Request $request) | |
{ | |
$validatedData = $request->validate([ | |
'title' => 'required|unique:posts|max:255', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Requests; | |
use Illuminate\Foundation\Http\FormRequest; | |
class PostStoreRequest extends FormRequest | |
{ | |
public function authorize() | |
{ | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use App\Http\Controllers\Controller; | |
use App\Http\Requests\SingingCircleRequest; | |
class PostController extends Controller | |
{ | |
public function store(PostStoreRequest $request) | |
{ | |
// You can just pull the data out of PostStoreRequest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Models; | |
use Illuminate\Database\Eloquent\Model; | |
class BlogPost extends Model | |
{ | |
public static $createRules = [ | |
'title' => 'required|unique:posts|max:255', | |
'body' => 'required', | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use App\Http\Controllers\Controller; | |
use App\Models\BlogPost; | |
class PostController extends Controller | |
{ | |
public function store(Request $request) | |
{ | |
$validatedData = $request->validate(BlogPost::$createRules); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Requests; | |
use App\Models\BlogPost; | |
use Illuminate\Foundation\Http\FormRequest; | |
class PostStoreRequest extends FormRequest | |
{ | |
public function rules() | |
{ | |
return BlogPost::$createRules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Requests; | |
use App\Models\BlogPost; | |
use Illuminate\Foundation\Http\FormRequest; | |
class PostStoreRequest extends FormRequest | |
{ | |
public function rules() | |
{ | |
return array_merge(BlogPost::$createRules, Author::$createRules); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<table-component | |
:data="[ | |
{ firstName: 'John', birthday: '04/10/1940'}, | |
{ firstName: 'Paul', birthday: '18/06/1942'}, | |
{ firstName: 'George', birthday: '25/02/1943'}, | |
{ firstName: 'Ringo', birthday: '07/07/1940'}, | |
]" | |
sort-by="firstName" | |
sort-order="asc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- test | |
variables: | |
MYSQL_DATABASE: sylius_test_cached | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: root | |
# This is normally provided by the .env file. But since we have to use "mysql" as host name, its defined | |
# here. We not using any .env file! | |
# The pattern is: mysql://user:password@host/database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- cp .env.test_cached.dist .env.test_cached | |
- set -a && source .env.test_cached && set +a |