style updates
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
<?php
|
||||
namespace Modules\Locations\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\View\View; use Modules\Locations\Models\Location;
|
||||
final class LocationController extends Controller { public function index(): View { return view('locations::admin.index',['locations'=>Location::orderBy('sort_order')->orderBy('name')->paginate(25)]); } public function store(Request $r): RedirectResponse { Location::create($r->validate(['name'=>['required','string','max:255'],'slug'=>['required','string','max:255','unique:locations,slug'],'type'=>['required','in:office,store,warehouse,venue,service'],'address'=>['nullable','string'],'postcode'=>['nullable','string','max:30'],'country'=>['nullable','string','max:120'],'phone'=>['nullable','string','max:80'],'email'=>['nullable','email','max:255'],'latitude'=>['nullable','numeric','between:-90,90'],'longitude'=>['nullable','numeric','between:-180,180'],'sort_order'=>['nullable','integer','min:0']])+['is_active'=>$r->boolean('is_active',true)]); return back()->with('status','Location created.'); } public function destroy(Location $location): RedirectResponse { $location->delete(); return back()->with('status','Location deleted.'); } }
|
||||
|
||||
namespace Modules\Locations\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Modules\Locations\Models\Location;
|
||||
|
||||
final class LocationController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
return view('locations::admin.index', ['locations' => Location::orderBy('sort_order')->orderBy('name')->paginate(25)]);
|
||||
}
|
||||
|
||||
public function store(Request $r): RedirectResponse
|
||||
{
|
||||
Location::create($r->validate(['name' => ['required', 'string', 'max:255'], 'slug' => ['required', 'string', 'max:255', 'unique:locations,slug'], 'type' => ['required', 'in:office,store,warehouse,venue,service'], 'address' => ['nullable', 'string'], 'postcode' => ['nullable', 'string', 'max:30'], 'country' => ['nullable', 'string', 'max:120'], 'phone' => ['nullable', 'string', 'max:80'], 'email' => ['nullable', 'email', 'max:255'], 'latitude' => ['nullable', 'numeric', 'between:-90,90'], 'longitude' => ['nullable', 'numeric', 'between:-180,180'], 'sort_order' => ['nullable', 'integer', 'min:0']]) + ['is_active' => $r->boolean('is_active', true)]);
|
||||
|
||||
return back()->with('status', 'Location created.');
|
||||
}
|
||||
|
||||
public function destroy(Location $location): RedirectResponse
|
||||
{
|
||||
$location->delete();
|
||||
|
||||
return back()->with('status', 'Location deleted.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user