나는 매우 유사한 3 개의 프로젝트가 있습니다 : 코드의 95 %. 편집을해야 할 때 그 세 번 복사해야하고 매우 나쁩니다!다른 환경에 대한 Laravel의 작은 차이점
그래서 하나의 프로젝트 만 있고 환경과 같은 작은 차이를 관리해야합니다. 그러나 나는 그 좋은 방법을 정말로 모른다.
예를 들어 I이 함수
public function save()
{
$this->validate($this->request, [
'firstname' => 'string',
'lastname' => 'string',
'gender' => 'string',
'phone' => 'bail|size:10|required',
'email' => 'email',
'birthdate' => 'bail|date',
'referral_code' => 'bail|string',
'city' => 'bail|string',
'call_state' => 'bail|string',
'call_date' => 'bail|date',
'campaign' => 'bail|string',
'note' => 'bail|string',
'overwritten_by_lead' => 'bail|integer',
'change_state_counter' => 'bail|integer'
]);
$data = $this->request->all();
$customer = $this->repository->create($data);
return $this->response->item($customer, $this->transformer)->setStatusCode(201);
}
다른 프로젝트와 차이가있는 제어기를 것은 :
public function save()
{
$this->validate($this->request, [
'firstname' => 'string',
'lastname' => 'string',
'gender' => 'string',
'phone' => 'bail|size:10|required',
'email' => 'email',
'birthdate' => 'bail|date',
'referral_code' => 'bail|string',
'city' => 'bail|string'
]);
$data = $this->request->all();
$customer = $this->repository->create($data);
return $this->response->item($customer, $this->transformer)->setStatusCode(201);
}
실체 내부의 또 다른 차이점은 예를 들어하기와 같다 :
protected $fillable = [
'firstname',
'lastname',
'phone',
'email',
'birthdate',
'gender',
'province',
'zip_code',
'address',
'city',
'campaign',
'overwritten_by_lead',
'change_state_counter',
'call_state',
'call_date',
'credit',
'referral_code'
];
그리고 이것은 또 다른
입니다. 0protected $fillable = [
'firstname',
'lastname',
'phone',
'email',
'birthdate',
'gender',
'province',
'zip_code',
'address',
'city'
];
3 가지 프로젝트에서 약간의 차이점이 있지만이를 관리해야합니다.
많은 경우 관리하고 싶지 않아 환경이 3 이상이 될 수 있기 때문에!
이러한 차이를 파일이 다른 여러 환경으로 덮어 쓰거나 관리하는 가장 좋은 방법은 무엇입니까?
예를 들어, 폴더 안에 프로젝트 1이 있습니다. CustomerController 및 CustomerEntity 환경의 모든 폴더에있는 다른 프로젝트의 경우와 같은 점은 다른 파일을 넣지 만 어떻게하면이 파일을 덮어 쓸 수 있습니까?
감사합니다.
환경이란 무엇입니까? –
내가 맞다면'development | 스테이징 | 생산 ...? –
환경 siteForEngland, siteForItaly, siteForSpain과 같은 다른 프로젝트를 선택하십시오. 나는 그것이 환경과 같다고 생각한다. –