public function store(Request $request)
    {
        $this->authorize('store', Location::class);
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate(['name' => 'required|max:128']);
        $location = new Location();
        $location->team_id = $this->userContext()->team_id;
        $location->name = $request->name;
        $location->save();
        return fractal($location, new LocationTransformer())
            ->withResourceName('location')
            ->respond();
    }
public function store(Request $request)
    {
        $this->authorize('store', Location::class);
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate(['name' => 'required|max:128']);
        $location = new Location();
        $location->team_id = $this->userContext()->team_id;
        $location->name = $request->name;
        $location->save();
        return fractal($location, new LocationTransformer())
            ->withResourceName('location')
            ->respond();
    }
public function store ( Request $ request ) { $ this -> authorize ( 'store' , Location :: class ) ; /** @noinspection PhpUndefinedMethodInspection */ $ request -> validate ( [ 'name' => 'required|max:128' ] ) ; $ location = new Location ( ) ; $ location -> team_id = $ this -> userContext ( ) -> team_id ; $ location -> name = $ request -> name ; $ location -> save ( ) ; return fractal ( $ location , new LocationTransformer ( ) ) -> withResourceName ( 'location' ) -> respond ( ) ; }
Store a new Location
@param  \Illuminate\Http\Request $request current Request object
@return \Illuminate\Http\Response JSON of the created Location
Store a new Location