Skip to content

Commit e8d5b49

Browse files
author
Volodymyr Ponomarenko
committed
Init
1 parent 238e1c1 commit e8d5b49

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class HomeController extends Controller
1616
*/
1717
public function index()
1818
{
19+
$this->createCL();
20+
1921
return view('welcome', [
2022
'haircuts' => Haircuts::all()->toArray() ?? [],
2123
'works' => Works::with('client')->with('haircut')->get()->toArray() ?? [],
@@ -25,7 +27,7 @@ public function index()
2527
public function create()
2628
{
2729

28-
$this->createCL();
30+
$hair = Haircuts::firstWhere('id', request()->get('haircut_id'));
2931

3032
$client = Clients::where([
3133
['first_name', request()->get('first_name')],
@@ -34,10 +36,13 @@ public function create()
3436
])->first();
3537

3638
if (!$client) {
39+
40+
3741
$client = Clients::create([
3842
'first_name' => request()->get('first_name'),
3943
'second_name' => request()->get('second_name'),
4044
'third_name' => request()->get('third_name'),
45+
'sex' => $hair->sex,
4146
]);
4247

4348
$client->save();

0 commit comments

Comments
 (0)