sork

Experience

170

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 0 Lessons Completed
  • 0 Favorites

14th June, 2018

sork left a reply on $this->authorize() Does Not Work In Controller • 2 months ago

@36864 thanks for your support. just found the mistake, i forgot to call Offer model in AuthServiceProvider.

sork left a reply on $this->authorize() Does Not Work In Controller • 2 months ago

@36864 already did it, same message (This action is unauthorized.) comes.

sork started a new conversation $this->authorize() Does Not Work In Controller • 2 months ago

I have created OfferPolicy class to provide authorization to resource action in Offer model. i have followed below steps:

create OfferPolicy.

php artisan make:policy OfferPolicy --model=Offer

register OfferPolicy in AuthServiceProvider

protected $policies = [
        Offer::class => OfferPolicy::class        
    ];

update policy in OfferPolicy class


public function update(User $user, Offer $offer)
    {
        return $user->id == $offer->user_id;
    }

OfferController

public function update(Request $request, Offer $offer) { $this->authorize('update', $offer);

    $offer->update($request->all());

return redirect()->route('offers.index')

}

when I am trying to update an offer, below error is coming.

Symfony \ Component \ HttpKernel \ Exception \ AccessDeniedHttpException
This action is unauthorized.

Anyone can help me on this problem, did i forget anything?

24th May, 2017

sork started a new conversation Design Database Tables For Real Estate Contracts • 1 year ago

I am creating an app to manage real estate sale and rent contracts. i do have three tables as below:

contracts : contain columns that are available in both rent and sale contracts such as: client name, landlord name, location ...etc.

rent_contracts: contain columns that are specific only for rent contracts such as: rent start date , end date ..etc.

sale_contracts: contain columns that are specific only for sale contracts.

i would like to ask

  • having three tables like above is a good approach?
  • is there any other table design idea for such a system?

6th March, 2017

sork started a new conversation Add Select Box And Input When Button Clicked • 1 year ago

i would like to have a button (Add Feature) to add a select box and a text input when clicked. i have made the select box like this:

$features = Config::get('property.features')

<select id="features" name="f_names[]" class="form-control">
    @foreach( $features as $feature ) 
    <option value="{{$feature}}">{{$feature}}</option>
    @endforeach
</select>

and text input is normal html:

<input type="text" name="f_values[]" class="form-control">

any advise on how to add above codes when Add Feature button clicked using pure javascript or jquery.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.