fix DirectionProfile store and update
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 1m50s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details

This commit is contained in:
aslan 2024-03-05 15:38:09 +03:00
parent b3d4231ec8
commit 6ae42fafe8
2 changed files with 3 additions and 5 deletions

View File

@ -33,7 +33,6 @@ class DirectionProfileController extends Controller
$directionProfile->description = $validated['description']; $directionProfile->description = $validated['description'];
$directionProfile->slug = $validated['slug']; $directionProfile->slug = $validated['slug'];
$directionProfile->position = $validated['position']; $directionProfile->position = $validated['position'];
$directionProfile->direction_id = $validated['direction_id'];
$directionProfile->save(); $directionProfile->save();
return redirect()->route('direction_profiles.index'); return redirect()->route('direction_profiles.index');
@ -61,7 +60,6 @@ class DirectionProfileController extends Controller
$directionProfile->description = $validated['description']; $directionProfile->description = $validated['description'];
$directionProfile->slug = $validated['slug']; $directionProfile->slug = $validated['slug'];
$directionProfile->position = $validated['position']; $directionProfile->position = $validated['position'];
$directionProfile->direction_id = $validated['direction_id'];
$directionProfile->save(); $directionProfile->save();
return redirect()->route('direction_profiles.index'); return redirect()->route('direction_profiles.index');
@ -69,6 +67,9 @@ class DirectionProfileController extends Controller
public function destroy(DirectionProfile $directionProfile): RedirectResponse public function destroy(DirectionProfile $directionProfile): RedirectResponse
{ {
if ($directionProfile->direction()->exists()) {
return back();
}
$directionProfile->delete(); $directionProfile->delete();
return redirect()->route('direction_profiles.index'); return redirect()->route('direction_profiles.index');
} }

View File

@ -8,9 +8,6 @@ use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder class DatabaseSeeder extends Seeder
{ {
/**
* Seed the application's database.
*/
public function run(): void public function run(): void
{ {
User::factory()->create([ User::factory()->create([