forked from eatvio/eatvio-infra
static analizys update
This commit is contained in:
@@ -5,26 +5,30 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Diary;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\View;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
public $weekStartsAt;
|
||||
public string|int|null $weekStartsAt;
|
||||
|
||||
public $weekEndsAt;
|
||||
public string|int|null $weekEndsAt;
|
||||
|
||||
public $startsAt;
|
||||
public Carbon $startsAt;
|
||||
|
||||
public $endsAt;
|
||||
public Carbon $endsAt;
|
||||
|
||||
public $gridStartsAt;
|
||||
public string|int|null $gridStartsAt;
|
||||
|
||||
public $gridEndsAt;
|
||||
public string|int|null $gridEndsAt;
|
||||
|
||||
public function __construct($initialYear = null, $initialMonth = null, $weekStartsAt = null)
|
||||
{
|
||||
public function __construct(
|
||||
string|int|null $initialYear = null,
|
||||
string|int|null $initialMonth = null,
|
||||
string|int|null $weekStartsAt = null
|
||||
) {
|
||||
$this->weekStartsAt = $weekStartsAt ?? Carbon::MONDAY;
|
||||
$this->weekEndsAt = $this->weekStartsAt === Carbon::MONDAY
|
||||
? Carbon::SUNDAY
|
||||
@@ -38,13 +42,13 @@ class CalendarController extends Controller
|
||||
$this->calculateGridStartsEnds();
|
||||
}
|
||||
|
||||
public function calculateGridStartsEnds()
|
||||
public function calculateGridStartsEnds(): void
|
||||
{
|
||||
$this->gridStartsAt = $this->startsAt->clone()->startOfWeek($this->weekStartsAt);
|
||||
$this->gridEndsAt = $this->endsAt->clone()->endOfWeek($this->weekEndsAt);
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
public function index(): View|ViewFactory
|
||||
{
|
||||
$curUser = Auth::user();
|
||||
$fullGridPeriod = CarbonPeriod::create(
|
||||
@@ -52,8 +56,9 @@ class CalendarController extends Controller
|
||||
'1 day',
|
||||
$this->gridEndsAt
|
||||
);
|
||||
|
||||
$filledDays = Diary::where('user_id', $curUser->id)
|
||||
->whereMonth('date', now()->month)
|
||||
->whereMonth('date', (string) now()->month)
|
||||
->get()
|
||||
->keyBy('date');
|
||||
|
||||
|
||||
@@ -3,61 +3,15 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\ChatMessageUpdated;
|
||||
use App\Messages\ChatMessage;
|
||||
use App\Models\Chat;
|
||||
use App\Models\User;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ChatMessage
|
||||
{
|
||||
public $id;
|
||||
|
||||
public $payload;
|
||||
|
||||
public function __construct($id, $payload)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->payload = $payload;
|
||||
}
|
||||
|
||||
public function someRandomFillFunction()
|
||||
{
|
||||
$users1 = User::all()->pluck('id');
|
||||
$users2 = User::all()->pluck('id');
|
||||
$faker = Faker\Factory::create();
|
||||
|
||||
$users1->each(
|
||||
function ($user1, $key) use ($faker, $users2) {
|
||||
$users2->each(
|
||||
function ($user2) use ($faker, $user1) {
|
||||
if ($user1 === $user2) {
|
||||
return;
|
||||
}
|
||||
$data1 = [
|
||||
'from_user_id' => $user2,
|
||||
'to_user_id' => $user1,
|
||||
'data' => $faker->text(),
|
||||
];
|
||||
|
||||
$data2 = [
|
||||
'from_user_id' => $user1,
|
||||
'to_user_id' => $user2,
|
||||
'data' => $faker->text(),
|
||||
];
|
||||
|
||||
$newMessage = (new Chat())->forceFill($data1);
|
||||
$newMessage->save();
|
||||
$newMessage = (new Chat())->forceFill($data2);
|
||||
$newMessage->save();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class ChatController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
public function index(): View|ViewFactory
|
||||
{
|
||||
// $_ = "from_user_id to_user_id";
|
||||
$curUserId = Auth()->user()->id;
|
||||
@@ -91,17 +45,19 @@ class ChatController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
/*
|
||||
* public function create(): void
|
||||
{
|
||||
ChatMessageUpdated::dispatch(new ChatMessage(time(), 'some text '.md5(time())));
|
||||
ChatMessageUpdated::dispatch(
|
||||
new ChatMessage(
|
||||
time(),
|
||||
'some text '.md5(' '.time())
|
||||
)
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
public function show(int $lastChatUser): View
|
||||
public function show(int $lastChatUser): View|ViewFactory
|
||||
{
|
||||
$lastChatUser = User::find($lastChatUser);
|
||||
// $_ = "from_user_id to_user_id";
|
||||
@@ -129,7 +85,7 @@ class ChatController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
private function makeChanName($from, $to)
|
||||
private function makeChanName(int $from, int $to): string
|
||||
{
|
||||
return (int) $from < (int) $to
|
||||
? $from.'_'.$to
|
||||
|
||||
@@ -32,7 +32,7 @@ class DiaryController extends Controller
|
||||
return view('diary.show', ['curDiary' => $diary, 'daysCount' => $daysCount]);
|
||||
}
|
||||
|
||||
public function edit($id): View
|
||||
public function edit(int $id): View
|
||||
{
|
||||
$curDiary = Diary::find($id);
|
||||
$daysCount = Diary::where('user_id', auth()->id())->count();
|
||||
@@ -47,7 +47,7 @@ class DiaryController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
/* dd($request, $id, $request->input()); */
|
||||
$curDiary = Diary::find($id);
|
||||
@@ -79,7 +79,7 @@ class DiaryController extends Controller
|
||||
$curDiary->wakeup = '06:30';
|
||||
$curDiary->retire = '22:30';
|
||||
$curDiary->user_id = $curUserId;
|
||||
$curDiary->closed = false;
|
||||
$curDiary->closed = (int)false;
|
||||
$curDiary->comment = '';
|
||||
$curDiary->save();
|
||||
|
||||
|
||||
@@ -2,71 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Finance;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FinanceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Finance $finance)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Finance $finance)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Finance $finance)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Finance $finance)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class RegistrationStartController extends Controller
|
||||
{
|
||||
public function start()
|
||||
public function start(): RedirectResponse
|
||||
{
|
||||
session()->flush();
|
||||
|
||||
|
||||
@@ -3,72 +3,14 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\UserDetailz;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(User $user)
|
||||
{
|
||||
/* return view('user.show', ['user' => $user]); */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(UserDetailz $userDetailz)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, UserDetailz $userDetailz)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(UserDetailz $userDetailz)
|
||||
public function show(User $user): View|ViewFactory
|
||||
{
|
||||
return view('user.show', ['user' => $user]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user