-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
233 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import{a as f}from"./app-455c4098.js";export{f as default}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import"./app-455c4098.js"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import"./app-455c4098.js"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import"./app-455c4098.js"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import"./app-455c4098.js"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,7 @@ | |
[x-cloak] { | ||
visibility: hidden !important; | ||
} | ||
|
||
img { | ||
border-radius: config('border-radius-sm', $display); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@use 'sprucecss/scss/spruce' as *; | ||
|
||
@include font-face( | ||
'Manrope', | ||
'/vendor/root/fonts/manrope-v14-latin-regular.woff2' | ||
); | ||
|
||
@include font-face( | ||
'Manrope', | ||
'/vendor/root/fonts/manrope-v14-latin-500.woff2', | ||
500 | ||
); | ||
|
||
@include font-face( | ||
'Manrope', | ||
'/vendor/root/fonts/manrope-v14-latin-600.woff2', | ||
600 | ||
); | ||
|
||
@include font-face( | ||
'Manrope', | ||
'/vendor/root/fonts/manrope-v14-latin-800.woff2', | ||
700 | ||
); | ||
|
||
@include font-face( | ||
'Open Sans', | ||
'/vendor/root/fonts/open-sans-v35-latin-regular.woff2' | ||
); | ||
|
||
@include font-face( | ||
'Open Sans', | ||
'/vendor/root/fonts/open-sans-v35-latin-700.woff2', | ||
700 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@forward 'config'; | ||
@forward 'font'; | ||
@forward 'styles'; | ||
@forward 'dark-mode'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<?php | ||
|
||
namespace Cone\Root\Http\Controllers; | ||
|
||
use Cone\Root\Http\Requests\CreateRequest; | ||
use Cone\Root\Http\Requests\IndexRequest; | ||
use Cone\Root\Http\Requests\ResourceRequest; | ||
use Cone\Root\Http\Requests\ShowRequest; | ||
use Cone\Root\Http\Requests\UpdateRequest; | ||
use Cone\Root\Support\Alert; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Redirect; | ||
use Inertia\Inertia; | ||
use Inertia\Response; | ||
|
||
class HasOneOrManyController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
*/ | ||
public function index(Request $request): Response | ||
{ | ||
$field = $request->resolved(); | ||
|
||
return Inertia::render( | ||
'Relations/Index', | ||
$field->toIndex($request, $model) | ||
); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @param \Cone\Root\Http\Requests\CreateRequest $request | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @return \Inertia\Response | ||
*/ | ||
public function create(CreateRequest $request, Model $model): Response | ||
{ | ||
$field = $request->resolved(); | ||
|
||
return Inertia::render( | ||
'Relations/Form', | ||
$field->toCreate($request, $model) | ||
); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Cone\Root\Http\Requests\CreateRequest $request | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function store(CreateRequest $request, Model $model): RedirectResponse | ||
{ | ||
$field = $request->resolved(); | ||
|
||
$relation = $field->getRelation($model); | ||
|
||
$related = tap($relation->getRelated(), static function (Model $related) use ($model): void { | ||
$related->setRelation('parent', $model); | ||
}); | ||
|
||
$fields = $field->resolveFields($request)->available($request, $model, $related); | ||
|
||
$request->validate($fields->mapToValidate($request, $related)); | ||
|
||
$fields->each->persist($request, $related); | ||
|
||
$relation->save($related); | ||
|
||
$path = sprintf('%s/%s', $request->resolved()->resolveUri($request), $related->getKey()); | ||
|
||
return Redirect::to($path) | ||
->with('alerts.relation-created', Alert::success(__('The relation has been created!'))); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param \Cone\Root\Http\Requests\ShowRequest $request | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @return \Inertia\Response | ||
*/ | ||
public function show(ShowRequest $request, Model $model, Model $related): Response | ||
{ | ||
return Inertia::render( | ||
'Relations/Show', | ||
$request->resolved()->toShow($request, $model, $related) | ||
); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param \Cone\Root\Http\Requests\UpdateRequest $request | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @return \Inertia\Response | ||
*/ | ||
public function edit(UpdateRequest $request, Model $model, Model $related): Response | ||
{ | ||
$field = $request->resolved(); | ||
|
||
return Inertia::render( | ||
'Relations/Form', | ||
$field->toEdit($request, $model, $related) | ||
); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Cone\Root\Http\Requests\UpdateRequest $request | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @param \Illuminate\Database\Eloquent\Model $related | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function update(UpdateRequest $request, Model $model, Model $related): RedirectResponse | ||
{ | ||
$field = $request->resolved(); | ||
|
||
$related->setRelation('parent', $model); | ||
|
||
$fields = $field->resolveFields($request)->available($request, $model, $related); | ||
|
||
$request->validate($fields->mapToValidate($request, $related)); | ||
|
||
$fields->each->persist($request, $related); | ||
|
||
$related->save(); | ||
|
||
$path = sprintf('%s/%s/edit', $request->resolved()->resolveUri($request), $related->getKey()); | ||
|
||
return Redirect::to($path) | ||
->with('alerts.relation-updated', Alert::success(__('The relation has been updated!'))); | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param \Cone\Root\Http\Requests\ResourceRequest $request | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @param \Illuminate\Database\Eloquent\Model $related | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function destroy(ResourceRequest $request, Model $model, Model $related): RedirectResponse | ||
{ | ||
$trashed = class_uses_recursive(SoftDeletes::class) && $related->trashed(); | ||
|
||
$trashed ? $related->forceDelete() : $related->delete(); | ||
|
||
$path = $request->resolved()->resolveUri($request); | ||
|
||
return Redirect::to($path) | ||
->with('alerts.relation-deleted', Alert::success(__('The relation has been deleted!'))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters