for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Encore\Admin\Controllers;
trait HasResourceActions
{
/**
* Update the specified resource in storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update($id)
return $this->resource->form()->update($id);
resource
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* Store a newly created resource in storage.
* @return mixed
public function store()
return $this->resource->form()->store();
* Remove the specified resource from storage.
public function destroy($id)
if ($this->resource->form()->destroy($id)) {
$data = [
'status' => true,
'message' => trans('admin.delete_succeeded'),
];
} else {
'status' => false,
'message' => trans('admin.delete_failed'),
return response()->json($data);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: