-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes #15, by adding api call * Update status text * Using this.$parent.resource.id.value now.
- Loading branch information
Showing
6 changed files
with
71 additions
and
14 deletions.
There are no files selected for viewing
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
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,28 @@ | ||
<?php | ||
|
||
namespace Davidpiesse\NovaToggle; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class ApiController | ||
{ | ||
public function index(\Laravel\Nova\Http\Requests\ResourceDetailRequest $request) | ||
{ | ||
$resourceClass = $request->resource(); | ||
$modelClass = $resourceClass::$model; | ||
$model = $modelClass::find($request->post('resourceId')); | ||
|
||
if($model) { | ||
$model->{$request->post('fieldName')} = $request->post('value'); | ||
$model->save(); | ||
|
||
return [ | ||
'success' => true | ||
]; | ||
} | ||
|
||
return [ | ||
'success' => false | ||
]; | ||
} | ||
} |
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