Skip to content

Releases: phpsa/laravel-api-controller

Removed Dead Code

29 Mar 02:00
8b9b163
Compare
Choose a tag to compare
2.2.1

Update MethodRules.php

Store / update request combine / seperate

29 Mar 01:46
9fee554
Compare
Choose a tag to compare
  • fixes issue where should be returning not-found for items that do not exist
  • added new trait \Phpsa\LaravelApiController\Http\Request\Traits\MethodRules to allow you to use the same request for different request types
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Phpsa\LaravelApiController\Http\Request\Traits\MethodRules;

class PostRequest extends FormRequest
{

    use MethodRules;
    /**
     * Get the validation rules that apply to all requests.
     *
     * @return array
     */
    public function commonRules()
    {
        //Only admins can set someone else as a user id
        $userIdRule = auth()->user()->hasRole('Admin') ? 'optional' : 'prohibited';

        return [
            'title'        => ['string'],
            'description'  => ['string'],
            'user_id'      => ['int',$userIdRule],
            'image'        => ['nullable'],
            'category_id'  => ['int', 'nullable'],
            'published_at' => ['date', 'nullable'],
        ];
    }

    public function storeRules() //called from controller store method
    {

        return [
            'title'       => ['string','required'],
            'description' => ['string','required'],
        ];
    }

    public function updateRules() //called from controller update method
    {
        return [
            'published_at'       => ['date','required','nullable'],
        ];
    }


}

Raw Query Fix

02 Mar 22:20
Compare
Choose a tag to compare

Raw Queries where breaking the allowedfields functionality from v1,
This patch restores the rawQuery back to an array instead of an StdClass object when passing to the api resource as was done in V1

BugFix

10 Feb 03:18
Compare
Choose a tag to compare
  • fixed request mapping on validations / requests / events
  • bugfix make command for resources

2.0.0

02 Feb 04:05
Compare
Choose a tag to compare

Upgrading from V1
The only breaking change would be that we no longer use the BaseRepository Class, so any references to it should be switched out for the Eloquent Builder

Changes

  • Removed BasedRepository in favour of Eloquent Builder
  • Code tidy-up and some traits moved
  • new tests implemented
  • api make command suite upgraded
  • added db macros for getRaw, paginateRaw
  • added optional validation request trait for formRequest to seperate rules per action.

Supports Laravel 6,7 & 8

Release Candidate - no more breaking changes should now be slipped in.

25 Jan 23:25
Compare
Choose a tag to compare
2.0.0-rc.1

Laravel 6 test case dir not existing for touch

Beta Update

22 Jan 03:06
Compare
Choose a tag to compare
2.0.0-b.3

Some code tidy

Beta Release

18 Jan 03:44
14b4d67
Compare
Choose a tag to compare
Beta Release Pre-release
Pre-release
    • Postman method in controller
  • Fixes missing :class in controller resource properties

2.0.0-a.1

22 Dec 03:19
Compare
Choose a tag to compare
2.0.0-a.1 Pre-release
Pre-release
  • remove Repository in favour of Eloquent/Builder
  • General code tidy

** more to come **

Cli tools updates

20 Dec 22:06
Compare
Choose a tag to compare

cli tools are now more optimised and use more core functionality, also creates factories