Update to laravel 12, other changes.

This commit is contained in:
Simon Pocrnjič 2025-03-25 21:38:24 +01:00
parent 0f8cfd3f16
commit 86a021143a
22 changed files with 2820 additions and 1504 deletions

View File

@ -4,6 +4,8 @@
use App\Models\ClientCase; use App\Models\ClientCase;
use App\Models\Contract; use App\Models\Contract;
use Exception;
use Illuminate\Database\QueryException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Inertia\Inertia; use Inertia\Inertia;
@ -121,27 +123,33 @@ public function updateContract(ClientCase $clientCase, String $uuid, Request $re
} }
public function storeActivity(ClientCase $clientCase, Request $request) { public function storeActivity(ClientCase $clientCase, Request $request) {
try {
$attributes = $request->validate([ $attributes = $request->validate([
'due_date' => 'nullable|date', 'due_date' => 'nullable|date',
'amount' => 'nullable|decimal:0,4', 'amount' => 'nullable|decimal:0,4',
'note' => 'string', 'note' => 'nullable|string',
'action_id' => 'exists:\App\Models\Action,id', 'action_id' => 'exists:\App\Models\Action,id',
'decision_id' => 'exists:\App\Models\Decision,id' 'decision_id' => 'exists:\App\Models\Decision,id'
]); ]);
//Create activity //Create activity
$activity = $clientCase->activities()->create($attributes); $row = $clientCase->activities()->create($attributes);
/*foreach ($activity->decision->events as $e) {
foreach ($activity->decision->events as $e) {
$class = '\\App\\Events\\' . $e->name; $class = '\\App\\Events\\' . $e->name;
event(new $class($clientCase)); event(new $class($clientCase));
}*/
logger()->info('Activity successfully inserted', $attributes);
return to_route('clientCase.show', $clientCase)->with('success', 'Successful created!');
} catch (QueryException $e) {
logger()->error('Database error occurred:', ['error' => $e->getMessage()]);
return back()->with('error', 'Failed to insert activity. ' . $e->getMessage());
} catch (Exception $e) {
logger()->error('An unexpected error occurred:', ['error' => $e->getMessage()]);
// Return a generic error response
return back()->with('error', 'An unexpected error occurred. Please try again later.');
} }
return to_route('clientCase.show', $clientCase);
} }
public function deleteContract(ClientCase $clientCase, String $uuid, Request $request) { public function deleteContract(ClientCase $clientCase, String $uuid, Request $request) {

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class DecisionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -21,4 +21,31 @@ public function index(Request $request){
] ]
); );
} }
public function updateAction(int $id, Request $request) {
$row = \App\Models\Action::findOrFail($id);
$attributes = $request->validate([
'name' => 'required|string|max:50',
'color_tag' => 'nullable|string|max:25',
'decisions' => 'nullable|array',
'decisions.*.id' => 'required_with:decisions.*|integer|exists:decisions,id',
'decisions.*.name' => 'required_with:decisions.*|string|max:50'
]);
$decisionIds = collect($attributes['decisions'] ?? [])->pluck('id')->toArray();
\DB::transaction(function() use ($attributes, $decisionIds, $row) {
$row->update([
'name' => $attributes['name'],
'color_tag' => $attributes['color_tag']
]);
$row->decisions()->sync($decisionIds);
});
logger()->info('Model updated successfully', ['model_id' => $row->id]);
return to_route('settings')->with('success', 'Update successful!');
}
} }

View File

@ -14,6 +14,8 @@ class Action extends Model
use HasFactory; use HasFactory;
use Searchable; use Searchable;
protected $fillable = ['name', 'color_tag'];
public function decisions(): BelongsToMany public function decisions(): BelongsToMany
{ {
return $this->belongsToMany(\App\Models\Decision::class); return $this->belongsToMany(\App\Models\Decision::class);

View File

@ -7,16 +7,15 @@
"require": { "require": {
"php": "^8.2", "php": "^8.2",
"arielmejiadev/larapex-charts": "^2.1", "arielmejiadev/larapex-charts": "^2.1",
"diglactic/laravel-breadcrumbs": "^9.0", "diglactic/laravel-breadcrumbs": "^10.0",
"http-interop/http-factory-guzzle": "^1.2", "http-interop/http-factory-guzzle": "^1.2",
"inertiajs/inertia-laravel": "^1.0", "inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^11.9", "laravel/framework": "12.0",
"laravel/jetstream": "^5.2", "laravel/jetstream": "^5.2",
"laravel/sanctum": "^4.0", "laravel/sanctum": "^4.0",
"laravel/scout": "^10.11", "laravel/scout": "^10.11",
"laravel/tinker": "^2.9", "laravel/tinker": "^2.9",
"meilisearch/meilisearch-php": "^1.11", "meilisearch/meilisearch-php": "^1.11",
"robertboes/inertia-breadcrumbs": "^0.6.0",
"tightenco/ziggy": "^2.0" "tightenco/ziggy": "^2.0"
}, },
"require-dev": { "require-dev": {
@ -24,8 +23,9 @@
"laravel/pint": "^1.13", "laravel/pint": "^1.13",
"laravel/sail": "^1.26", "laravel/sail": "^1.26",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1", "nunomaduro/collision": "8.7",
"phpunit/phpunit": "^11.0.1" "pestphp/pest": "^3.7",
"phpunit/phpunit": "^11.3"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

2434
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('activities', function (Blueprint $table) {
$table->date('due_date')->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

1415
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
"build": "vite build" "build": "vite build"
}, },
"devDependencies": { "devDependencies": {
"@inertiajs/vue3": "^1.0.14", "@inertiajs/vue3": "2.0",
"@mdi/js": "^7.4.47", "@mdi/js": "^7.4.47",
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10", "@tailwindcss/typography": "^0.5.10",
@ -28,7 +28,7 @@
"@headlessui/vue": "^1.7.23", "@headlessui/vue": "^1.7.23",
"@heroicons/vue": "^2.1.5", "@heroicons/vue": "^2.1.5",
"@vuepic/vue-datepicker": "^9.0.3", "@vuepic/vue-datepicker": "^9.0.3",
"apexcharts": "^3.54.1", "apexcharts": "^4.0.0",
"flowbite": "^2.5.2", "flowbite": "^2.5.2",
"flowbite-vue": "^0.1.6", "flowbite-vue": "^0.1.6",
"lodash": "^4.17.21", "lodash": "^4.17.21",

View File

@ -0,0 +1,30 @@
<script setup>
import { ref, watch } from 'vue';
defineProps({
type: {
type: String,
default: 'submit',
},
bgcolor: {
type: String,
default: 'bg-blue-500'
},
});
const isHover = ref(false);
watch(
() => isHover.value,
(isHover) => {
console.log(isHover)
}
)
</script>
<template>
<button :type="type" class="inline-flex items-center px-4 py-2 bg-blue-500 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-blue-700 focus:bg-blue-700 active:bg-blue-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50 transition ease-in-out duration-150" :class="[bgcolor, color]">
<slot />
</button>
</template>

View File

@ -1,10 +1,12 @@
<script setup> <script setup>
import ActionMessage from '@/Components/ActionMessage.vue'; import ActionMessage from '@/Components/ActionMessage.vue';
import BasicButton from '@/Components/buttons/BasicButton.vue';
import Drawer from '@/Components/Drawer.vue'; import Drawer from '@/Components/Drawer.vue';
import InputLabel from '@/Components/InputLabel.vue'; import InputLabel from '@/Components/InputLabel.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue'; import PrimaryButton from '@/Components/PrimaryButton.vue';
import SectionTitle from '@/Components/SectionTitle.vue'; import SectionTitle from '@/Components/SectionTitle.vue';
import TextInput from '@/Components/TextInput.vue'; import TextInput from '@/Components/TextInput.vue';
import { PlusIcon } from '@/Utilities/Icons';
import { useForm } from '@inertiajs/vue3'; import { useForm } from '@inertiajs/vue3';
import { FwbTextarea } from 'flowbite-vue'; import { FwbTextarea } from 'flowbite-vue';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
@ -45,6 +47,17 @@ watch(
} }
); );
watch(
() => form.due_date,
(due_date) => {
if (due_date) {
let date = new Date(form.due_date).toISOString().split('T')[0];
console.table({old: due_date, new: date});
}
}
);
const store = () => { const store = () => {
console.table({ console.table({
due_date: form.due_date, due_date: form.due_date,
@ -55,13 +68,19 @@ const store = () => {
}); });
form.post(route('clientCase.activity.store', props.client_case), { form.post(route('clientCase.activity.store', props.client_case), {
onBefore: () => { onBefore: () => {
if(form.due_date !== null || form.due_date !== '') { if(form.due_date) {
form.due_date = new Date(form.due_date).toISOString(); form.due_date = new Date(form.due_date).toISOString().split('T')[0];
} }
}, },
onSuccess: () => { onSuccess: () => {
close(); close();
form.reset(); form.reset();
},
onError: (errors) => {
console.log('Validation or server error:', errors);
},
onFinish: () => {
console.log('Request finished processing.')
} }
}); });
} }
@ -75,32 +94,6 @@ const store = () => {
<template #title>Dodaj aktivnost</template> <template #title>Dodaj aktivnost</template>
<template #content> <template #content>
<form @submit.prevent="store"> <form @submit.prevent="store">
<SectionTitle class="mt-4 border-b mb-4">
<template #title>
Aktivnost
</template>
</SectionTitle>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityDueDate" value="Datum zapadlosti"/>
<vue-date-picker
id="activityDueDate"
:enable-time-picker="false"
format="dd.MM.yyyy"
class="mt-1 block w-full"
v-model="form.due_date"
/>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityAmount" value="Znesek"/>
<TextInput
id="activityAmount"
ref="activityAmountinput"
v-model="form.amount"
type="number"
class="mt-1 block w-full"
autocomplete="0.00"
/>
</div>
<div class="col-span-6 sm:col-span-4"> <div class="col-span-6 sm:col-span-4">
<InputLabel for="activityAction" value="Akcija"/> <InputLabel for="activityAction" value="Akcija"/>
<select <select
@ -134,14 +127,37 @@ const store = () => {
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm" class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
/> />
</div> </div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityDueDate" value="Datum zapadlosti"/>
<vue-date-picker
id="activityDueDate"
:enable-time-picker="false"
format="dd.MM.yyyy"
class="mt-1 block w-full"
v-model="form.due_date"
/>
</div>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="activityAmount" value="Znesek"/>
<TextInput
id="activityAmount"
ref="activityAmountinput"
v-model="form.amount"
type="number"
class="mt-1 block w-full"
autocomplete="0.00"
/>
</div>
<div class="flex justify-end mt-4"> <div class="flex justify-end mt-4">
<ActionMessage :on="form.recentlySuccessful" class="me-3"> <ActionMessage :on="form.recentlySuccessful" class="me-3">
Saved. Shranjuje.
</ActionMessage> </ActionMessage>
<BasicButton
<PrimaryButton :class="{ 'opacity-25': form.processing }" :disabled="form.processing"> :class="{ 'opacity-25': form.processing }"
Save :disabled="form.processing"
</PrimaryButton> >
Shrani
</BasicButton>
</div> </div>
</form> </form>
</template> </template>

View File

@ -23,7 +23,7 @@ const createBody = (data) => {
data.forEach((p) => { data.forEach((p) => {
const createdDate = new Date(p.created_at).toLocaleDateString('de'); const createdDate = new Date(p.created_at).toLocaleDateString('de');
const dueDate = (p.due_date === null) ? new Date().toLocaleDateString('de') : null; const dueDate = (p.due_date) ? new Date().toLocaleDateString('de') : null;
const cols = [ const cols = [
C_TD.make(createdDate, 'body' ), C_TD.make(createdDate, 'body' ),

View File

@ -9,6 +9,7 @@ import ContractTable from "./Partials/ContractTable.vue";
import ActivityDrawer from "./Partials/ActivityDrawer.vue"; import ActivityDrawer from "./Partials/ActivityDrawer.vue";
import ActivityTable from "./Partials/ActivityTable.vue"; import ActivityTable from "./Partials/ActivityTable.vue";
import { AngleDownIcon, AngleUpIcon } from "@/Utilities/Icons"; import { AngleDownIcon, AngleUpIcon } from "@/Utilities/Icons";
import Pagination from "@/Components/Pagination.vue";
const props = defineProps({ const props = defineProps({
client: Object, client: Object,
@ -134,13 +135,15 @@ const hideClietnDetails = () => {
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4"> <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4">
<div class="mx-auto max-w-4x1"> <div class="mx-auto max-w-4x1">
<div class="flex justify-between p-3"> <div class="flex justify-between p-4">
<SectionTitle> <SectionTitle>
<template #title> Aktivnosti </template> <template #title>Aktivnosti</template>
</SectionTitle> </SectionTitle>
<FwbButton @click="openDrawerAddActivity">Nova</FwbButton> <FwbButton @click="openDrawerAddActivity">Nova</FwbButton>
</div> </div>
<ActivityTable :client_case="client_case" :activities="activities" /> <ActivityTable :client_case="client_case" :activities="activities" />
<Pagination :links="activities.links" :from="activities.from" :to="activities.to" :total="activities.total" />
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,25 +1,26 @@
<script setup> <script setup>
import { FwbTable, FwbTableBody, FwbTableHead, FwbTableHeadCell, FwbTableCell, FwbTableRow } from 'flowbite-vue'; import { FwbTable, FwbTableBody, FwbTableHead, FwbTableHeadCell, FwbTableCell, FwbTableRow, FwbDropdown } from 'flowbite-vue';
import { EditIcon, TrashBinIcon } from '@/Utilities/Icons'; import { DottedMenu, EditIcon, TrashBinIcon } from '@/Utilities/Icons';
import Drawer from '@/Components/Drawer.vue'; import Drawer from '@/Components/Drawer.vue';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useForm } from '@inertiajs/vue3'; import { useForm } from '@inertiajs/vue3';
import InputLabel from '@/Components/InputLabel.vue'; import InputLabel from '@/Components/InputLabel.vue';
import TextInput from '@/Components/TextInput.vue'; import TextInput from '@/Components/TextInput.vue';
import Multiselect from 'vue-multiselect'; import Multiselect from 'vue-multiselect';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import ActionMessage from '@/Components/ActionMessage.vue';
const props = defineProps({ const props = defineProps({
actions: Array, actions: Array,
decisions: Array decisions: Array
}); });
const menuDropdown = ref();
const drawerEdit = ref(false); const drawerEdit = ref(false);
const selectOptions = ref([]); const selectOptions = ref([]);
const selectValue = ref([]);
const form = useForm({ const form = useForm({
id: 0, id: 0,
name: '', name: '',
@ -32,39 +33,43 @@ const openEditDrawer = (item) => {
form.name = item.name; form.name = item.name;
form.color_tag = item.color_tag; form.color_tag = item.color_tag;
drawerEdit.value = true; drawerEdit.value = true;
console.log(item.decisions);
item.decisions.forEach((d) => { item.decisions.forEach((d) => {
selectValue.value.push({ form.decisions.push({
name: d.name, name: d.name,
code: d.name.substring(0,2).toLowerCase() + d.id id: d.id
}); });
}) })
} }
const closeEditDrawer = () => { const closeEditDrawer = () => {
form.reset();
drawerEdit.value = false; drawerEdit.value = false;
form.reset();
} }
const onColorPickerChange = () => { const onColorPickerChange = () => {
console.log(form.color_tag); console.log(form.color_tag);
} }
onMounted(() => { onMounted(() => {
props.decisions.forEach((d) => { props.decisions.forEach((d) => {
selectOptions.value.push({ selectOptions.value.push({
name: d.name, name: d.name,
code: d.name.substring(0,2).toLowerCase() + d.id id: d.id
});
}); });
console.log(selectOptions.value); });
}); });
const update = () => {
form.put(route('settings.actions.update', { id: form.id }), {
onSuccess: () => {
closeEditDrawer();
},
});
};
</script> </script>
<template> <template>
<fwb-table> <fwb-table>
@ -84,7 +89,7 @@ onMounted(() => {
<fwb-table-cell>{{ act.color_tag }}</fwb-table-cell> <fwb-table-cell>{{ act.color_tag }}</fwb-table-cell>
<fwb-table-cell>{{ act.decisions.length }}</fwb-table-cell> <fwb-table-cell>{{ act.decisions.length }}</fwb-table-cell>
<fwb-table-cell> <fwb-table-cell>
<button @click="openEditDrawer(act)"><EditIcon /></button> <button class="px-2" @click="openEditDrawer(act)"><EditIcon size="md" css="text-gray-500" /></button>
</fwb-table-cell> </fwb-table-cell>
</fwb-table-row> </fwb-table-row>
</fwb-table-body> </fwb-table-body>
@ -98,7 +103,7 @@ onMounted(() => {
<span>Spremeni akcijo</span> <span>Spremeni akcijo</span>
</template> </template>
<template #content> <template #content>
<form @submit.prevent=""> <form @submit.prevent="update">
<div class="col-span-6 sm:col-span-4"> <div class="col-span-6 sm:col-span-4">
<InputLabel for="name" value="Ime"/> <InputLabel for="name" value="Ime"/>
<TextInput <TextInput
@ -131,15 +136,25 @@ onMounted(() => {
<multiselect <multiselect
id="decisions" id="decisions"
ref="decisionsSelect" ref="decisionsSelect"
v-model="selectValue" v-model="form.decisions"
:options="selectOptions" :options="selectOptions"
:multiple="true" :multiple="true"
track-by="code" track-by="id"
:taggable="true" :taggable="true"
placeholder="Dodaj odločitev" placeholder="Dodaj odločitev"
label="name" label="name"
/> />
</div> </div>
<div class="flex justify-end mt-4">
<ActionMessage :on="form.recentlySuccessful" class="me-3">
Shranjuje.
</ActionMessage>
<PrimaryButton :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
Shrani
</PrimaryButton>
</div>
</form> </form>
</template> </template>
</Drawer> </Drawer>

View File

@ -53,7 +53,7 @@ const AlignCenterIcon = {
const EditIcon = { const EditIcon = {
__proto__: Icon, __proto__: Icon,
template: `<svg class="dark:text-white" :class="[defineSize(size),css]" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> template: `<svg :class="[defineSize(size),css]" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m14.304 4.844 2.852 2.852M7 7H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4.5m2.409-9.91a2.017 2.017 0 0 1 0 2.853l-6.844 6.844L8 14l.713-3.565 6.844-6.844a2.015 2.015 0 0 1 2.852 0Z"/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m14.304 4.844 2.852 2.852M7 7H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4.5m2.409-9.91a2.017 2.017 0 0 1 0 2.853l-6.844 6.844L8 14l.713-3.565 6.844-6.844a2.015 2.015 0 0 1 2.852 0Z"/>
</svg>` </svg>`
} }
@ -121,6 +121,14 @@ const PlusIcon = {
` `
} }
const DottedMenu = {
__proto__: Icon,
template: `<svg :class="[defineSize(size),css]" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 4 15">
<path d="M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" />
</svg>
`
}
export { export {
AddressBookIcon, AddressBookIcon,
AlignCenterIcon, AlignCenterIcon,
@ -132,5 +140,6 @@ export {
AngleUpIcon, AngleUpIcon,
UserEditIcon, UserEditIcon,
CirclePlusIcon, CirclePlusIcon,
PlusIcon PlusIcon,
DottedMenu
}; };

View File

@ -1,8 +1,21 @@
<?php <?php
use Illuminate\Foundation\Inspiring; /*use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
Artisan::command('inspire', function () { Artisan::command('inspire', function () {
$this->comment(Inspiring::quote()); $this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote')->hourly(); })->purpose('Display an inspiring quote')->hourly();*/
Artisan::command('question', function () {
$name = $this->ask('What is your name?');
$language = $this->choice('Which language do you prefer?', [
'PHP',
'Ruby',
'Python',
]);
$this->line('Your name is '.$name.' and you prefer '.$language.'.');
});

View File

@ -110,9 +110,10 @@
Route::delete('client-cases/{client_case:uuid}/contract/{uuid}', [ClientCaseContoller::class, 'deleteContract'])->name('clientCase.contract.delete'); Route::delete('client-cases/{client_case:uuid}/contract/{uuid}', [ClientCaseContoller::class, 'deleteContract'])->name('clientCase.contract.delete');
//client-case / activity //client-case / activity
Route::post('client-cases/{client_case:uuid}/activity', [ClientCaseContoller::class, 'storeActivity'])->name('clientCase.activity.store'); Route::post('client-cases/{client_case:uuid}/activity', [ClientCaseContoller::class, 'storeActivity'])->name('clientCase.activity.store');
//settings
Route::get('settings', [SettingController::class, 'index'])->name('settings'); Route::get('settings', [SettingController::class, 'index'])->name('settings');
Route::put('settings/actions/{id}', [SettingController::class, 'updateAction'])->name('settings.actions.update');
//Route::put()
//types //types
Route::get('types/address', function(Request $request){ Route::get('types/address', function(Request $request){

View File

@ -0,0 +1,22 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use App\Models\User;
class InsertDatabaseTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*/
public function test_example(): void
{
$this->actingAs($user = User::factory()->create());
$this->assertTrue(false);
}
}

View File

@ -6,5 +6,8 @@
abstract class TestCase extends BaseTestCase abstract class TestCase extends BaseTestCase
{ {
// public function testBasicTest(): void
{
$this->assertTrue(true);
}
} }

View File

@ -0,0 +1,23 @@
<?php
namespace Tests\Unit;
use Illuminate\Foundation\Testing\WithConsoleEvents;
use Tests\TestCase;
class ConsoleEventTest extends TestCase
{
use WithConsoleEvents;
/**
* A basic unit test example.
*/
public function test_example(): void
{
$this->artisan('question')
->expectsQuestion('What is your name?', 'Taylor Otwell')
->expectsQuestion('Which language do you prefer?', 'PHP')
->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')
->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')
->assertExitCode(0);
}
}

View File

@ -9,8 +9,37 @@ class ExampleTest extends TestCase
/** /**
* A basic test example. * A basic test example.
*/ */
public function test_that_true_is_true(): void public function test_that_true_is_true(): string
{ {
$this->assertTrue(true); $this->assertTrue(false);
return 'first';
} }
public function testPushAndPop(): void
{
$stack = [];
$this->assertSame(0, count($stack));
array_push($stack, 'foo');
$this->assertSame('foo', $stack[count($stack)-1]);
$this->assertSame(1, count($stack));
$this->assertSame('foo', array_pop($stack));
$this->assertSame(0, count($stack));
}
public function testDeprecationCanBeExpected(): void
{
$this->expectDeprecation();
// Optionally test that the message is equal to a string
$this->expectDeprecationMessage('foo');
// Or optionally test that the message matches a regular expression
$this->expectDeprecationMessageMatches('/foo/');
\trigger_error('foo', \E_USER_DEPRECATED);
}
} }