Skip to main content

Posts

Laravel Request Validator json response example

 Step 1 :  php artisan make : request  StoreArticleRequest Step 2 : <?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\JsonResponse; use Illuminate\Contracts\Validation\Validator; use Illuminate\Http\Exceptions\HttpResponseException; class StoreArticleRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize () { return true ; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules () { return [ 'title' => 'required' ]; } protected function failedValidation (Validator $validator ) { if ($this -> wantsJson () || $this -> ajax ()) { throw new HttpResponseException( response () -> json ([ 'status' => '
Recent posts

followers with following flag

$followers=DB::table('user_followers as f')->join('users as u', 'u.id', '=', 'f.follower_id')             ->leftJoin('user_followers AS b', function($join){                 $join->on('b.follower_id', '=', 'f.leader_id')                      ->on('b.leader_id', '=', 'u.id');             })             ->selectRaw(DB::raw("u.user_id,u.full_name,u.username,u.avatar,             case when b.follower_id is null then 0                 when b.follower_id is not null and  b.status=1 then 1             else 2             end as isFollowing,             case when b.follower_id is null then 'Follow'                 when b.follower_id is not null and  b.status=1 then 'Pending'             else 'Following'             end as isFollowing             "))             ->where("f.leader_id",$authUserId)          

Bad words or Swear words filter Jquery

Bad words or Swear words filter Jquery var blacklist = /\b(4r5e|5h1t|5hit|a55|anal|anus|ar5e|arrse|arse|ass|ass-fucker|asses|assfucker|assfukka|asshole|assholes|asswhole|a_s_s|b!tch|b00bs|b17ch|b1tch|ballbag|balls|ballsack|bastard|beastial|beastiality|bellend|bestial|bestiality|bi+ch|biatch|bitch|bitcher|bitchers|bitches|bitchin|bitching|bloody|blow job|blowjob|blowjobs|boiolas|bollock|bollok|boner|boob|boobs|booobs|boooobs|booooobs|booooooobs|breasts|buceta|bugger|bum|bunny fucker|butt|butthole|buttmuch|buttplug|c0ck|c0cksucker|carpet muncher|cawk|chink|cipa|cl1t|clit|clitoris|clits|cnut|cock|cock-sucker|cockface|cockhead|cockmunch|cockmuncher|cocks|cocksuck|cocksucked|cocksucker|cocksucking|cocksucks|cocksuka|cocksukka|cok|cokmuncher|coksucka|coon|cox|crap|cum|cummer|cumming|cums|cumshot|cunilingus|cunillingus|cunnilingus|cunt|cuntlick|cuntlicker|cuntlicking|cunts|cyalis|cyberfuc|cyberfuck|cyberfucked|cyberfucker|cyberfuckers|cyberfucking|d1ck|damn|dick|dickhead|dildo|dildos|dink|din

Magento usefull codes

Get order items inside the order $objectManager = \Magento\Framework\App\ObjectManager::getInstance();         $order = $objectManager->create( 'Magento\Sales\Model\Order' )->load($block->getRequest()->getParam( "order_id" ));         $easyParcelData[ 'shipping_address' ] = array(              'id'             => $order->getIncrementId(),              'status'         => $order->getStatus(),              'name'           => $order->getCustomerName(),              'email'          => $order->getCustomerEmail(),              'telephone'      => $order->getShippingAddress()->getTelephone(),              'street'         => $order->getShippingAddress()->getStreet(),              'postcode'        => $order->getShippingAddress()->getPostcode(),              'city'           => $order->getShippingAddress()-&

AWS EC2, LAMP, Laravel and RDS Installation / setup

This document shows you how to configure AWS environment in Amazon EC2 with RDS Instance. We need to login in to AWS to start the configuration. http://aws.amazon.com Login screen for AWS Management console: First thing we have to select is region. On which region you want to deploy your server. I am going to select Oregon region here for my setup. 1.       click on the launch instance button, 2.       It redirects to following screen. Here we have to search for required operating system or select from list,  here im selecting Ubuntu latest version 4.       After selecting operating system, choose the instance type according to our requirement. Here I need lower configuration so choosing t2.micro type instance.   5.       Click Next button, then you see the below screen. Here we to modify if any settings need to modify Like changing network/subnet. or can skip this by keeping default settings. 6.       Click on next button and Add the st