Spiral

Spiral

Member Since 3 Weeks Ago

Experience Points
2,240
Total
Experience

2,760 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
2
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
2,240 XP
Apr
03
1 day ago
Activity icon

Started a new Conversation Problem In Creating New Project

 Vue CLI v4.2.3
✨  Creating project in E:\VueProjects\vue-app.
🗃  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

npm ERR! Unexpected end of JSON input while parsing near '...L9/BUKt2wGEu3pa5gOo\n'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\HP\AppData\Roaming\npm-cache\_logs20-04-03T18_10_51_055Z-debug.log
 ERROR  command failed: npm install --loglevel error


node --version
v12.13.1

npm -v
6.12.1

vue --version
@vue/cli 4.2.3
Activity icon

Started a new Conversation Where From Should Start For Learning The Vue

i'm starting to learning Vue.js for revamp the laravel code

Plz anyone can give me advice or can provide solution where from should start for learn vue.js

Thanks in advance..

Apr
02
2 days ago
Activity icon

Replied to How Can Set Expiry Time For Laravel Jwt Dynamically

bro again let me check may be after cache clear may be will work

Activity icon

Replied to How Can Set Expiry Time For Laravel Jwt Dynamically

No brother i have not jwt functionality in .env file which overriding the default

Activity icon

Replied to How Can Set Expiry Time For Laravel Jwt Dynamically

<?php

/*
 * This file is part of jwt-auth.
 *
 * (c) Sean Tymon <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

return [

    /*
    |--------------------------------------------------------------------------
    | JWT Authentication Secret
    |--------------------------------------------------------------------------
    |
    | Don't forget to set this in your .env file, as it will be used to sign
    | your tokens. A helper command is provided for this:
    | `php artisan jwt:secret`
    |
    | Note: This will be used for Symmetric algorithms only (HMAC),
    | since RSA and ECDSA use a private/public key combo (See below).
    |
    */

    'secret' => env('JWT_SECRET'),

    /*
    |--------------------------------------------------------------------------
    | JWT Authentication Keys
    |--------------------------------------------------------------------------
    |
    | The algorithm you are using, will determine whether your tokens are
    | signed with a random string (defined in `JWT_SECRET`) or using the
    | following public & private keys.
    |
    | Symmetric Algorithms:
    | HS256, HS384 & HS512 will use `JWT_SECRET`.
    |
    | Asymmetric Algorithms:
    | RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
    |
    */

    'keys' => [

        /*
        |--------------------------------------------------------------------------
        | Public Key
        |--------------------------------------------------------------------------
        |
        | A path or resource to your public key.
        |
        | E.g. 'file://path/to/public/key'
        |
        */

        'public' => env('JWT_PUBLIC_KEY'),

        /*
        |--------------------------------------------------------------------------
        | Private Key
        |--------------------------------------------------------------------------
        |
        | A path or resource to your private key.
        |
        | E.g. 'file://path/to/private/key'
        |
        */

        'private' => env('JWT_PRIVATE_KEY'),

        /*
        |--------------------------------------------------------------------------
        | Passphrase
        |--------------------------------------------------------------------------
        |
        | The passphrase for your private key. Can be null if none set.
        |
        */

        'passphrase' => env('JWT_PASSPHRASE'),

    ],

    /*
    |--------------------------------------------------------------------------
    | JWT time to live
    |--------------------------------------------------------------------------
    |
    | Specify the length of time (in minutes) that the token will be valid for.
    | Defaults to 1 hour.
    |
    | You can also set this to null, to yield a never expiring token.
    | Some people may want this behaviour for e.g. a mobile app.
    | This is not particularly recommended, so make sure you have appropriate
    | systems in place to revoke the token if necessary.
    | Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
    |
    */

    'ttl' => env('JWT_TTL', 60*24*7),

    /*
    |--------------------------------------------------------------------------
    | Refresh time to live
    |--------------------------------------------------------------------------
    |
    | Specify the length of time (in minutes) that the token can be refreshed
    | within. I.E. The user can refresh their token within a 2 week window of
    | the original token being created until they must re-authenticate.
    | Defaults to 2 weeks.
    |
    | You can also set this to null, to yield an infinite refresh time.
    | Some may want this instead of never expiring tokens for e.g. a mobile app.
    | This is not particularly recommended, so make sure you have appropriate
    | systems in place to revoke the token if necessary.
    |
    */

    'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),

    /*
    |--------------------------------------------------------------------------
    | JWT hashing algorithm
    |--------------------------------------------------------------------------
    |
    | Specify the hashing algorithm that will be used to sign the token.
    |
    | See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL
    | for possible values.
    |
    */

    'algo' => env('JWT_ALGO', 'HS256'),

    /*
    |--------------------------------------------------------------------------
    | Required Claims
    |--------------------------------------------------------------------------
    |
    | Specify the required claims that must exist in any token.
    | A TokenInvalidException will be thrown if any of these claims are not
    | present in the payload.
    |
    */

    'required_claims' => [
        'iss',
        'iat',
        'exp',
        'nbf',
        'sub',
        'jti',
    ],

    /*
    |--------------------------------------------------------------------------
    | Persistent Claims
    |--------------------------------------------------------------------------
    |
    | Specify the claim keys to be persisted when refreshing a token.
    | `sub` and `iat` will automatically be persisted, in
    | addition to the these claims.
    |
    | Note: If a claim does not exist then it will be ignored.
    |
    */

    'persistent_claims' => [
        // 'foo',
        // 'bar',
    ],

    /*
    |--------------------------------------------------------------------------
    | Lock Subject
    |--------------------------------------------------------------------------
    |
    | This will determine whether a `prv` claim is automatically added to
    | the token. The purpose of this is to ensure that if you have multiple
    | authentication models e.g. `App\User` & `App\OtherPerson`, then we
    | should prevent one authentication request from impersonating another,
    | if 2 tokens happen to have the same id across the 2 different models.
    |
    | Under specific circumstances, you may want to disable this behaviour
    | e.g. if you only have one authentication model, then you would save
    | a little on token size.
    |
    */

    'lock_subject' => true,

    /*
    |--------------------------------------------------------------------------
    | Leeway
    |--------------------------------------------------------------------------
    |
    | This property gives the jwt timestamp claims some "leeway".
    | Meaning that if you have any unavoidable slight clock skew on
    | any of your servers then this will afford you some level of cushioning.
    |
    | This applies to the claims `iat`, `nbf` and `exp`.
    |
    | Specify in seconds - only if you know you need it.
    |
    */

    'leeway' => env('JWT_LEEWAY', 0),

    /*
    |--------------------------------------------------------------------------
    | Blacklist Enabled
    |--------------------------------------------------------------------------
    |
    | In order to invalidate tokens, you must have the blacklist enabled.
    | If you do not want or need this functionality, then set this to false.
    |
    */

    'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),

    /*
    | -------------------------------------------------------------------------
    | Blacklist Grace Period
    | -------------------------------------------------------------------------
    |
    | When multiple concurrent requests are made with the same JWT,
    | it is possible that some of them fail, due to token regeneration
    | on every request.
    |
    | Set grace period in seconds to prevent parallel request failure.
    |
    */

    'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),

    /*
    |--------------------------------------------------------------------------
    | Cookies encryption
    |--------------------------------------------------------------------------
    |
    | By default Laravel encrypt cookies for security reason.
    | If you decide to not decrypt cookies, you will have to configure Laravel
    | to not encrypt your cookie token by adding its name into the $except
    | array available in the middleware "EncryptCookies" provided by Laravel.
    | see https://laravel.com/docs/master/responses#cookies-and-encryption
    | for details.
    |
    | Set it to true if you want to decrypt cookies.
    |
    */

    'decrypt_cookies' => false,

    /*
    |--------------------------------------------------------------------------
    | Providers
    |--------------------------------------------------------------------------
    |
    | Specify the various providers used throughout the package.
    |
    */

    'providers' => [

        /*
        |--------------------------------------------------------------------------
        | JWT Provider
        |--------------------------------------------------------------------------
        |
        | Specify the provider that is used to create and decode the tokens.
        |
        */

        'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,

        /*
        |--------------------------------------------------------------------------
        | Authentication Provider
        |--------------------------------------------------------------------------
        |
        | Specify the provider that is used to authenticate users.
        |
        */

        'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,

        /*
        |--------------------------------------------------------------------------
        | Storage Provider
        |--------------------------------------------------------------------------
        |
        | Specify the provider that is used to store tokens in the blacklist.
        |
        */

        'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,

    ],

];
Activity icon

Replied to How Can Set Expiry Time For Laravel Jwt Dynamically

@zsoltgyure bro this code not working

'ttl' => env('JWT_TTL', 60*24*7)
Activity icon

Replied to How Can Set Expiry Time For Laravel Jwt Dynamically

@zsoltgyure bro for replying me

using

"tymon/jwt-auth": "dev-develop",
Activity icon

Started a new Conversation How Can Set Expiry Time For Laravel Jwt Dynamically

i have put these code but not working plz anyone give me best solution

JWTAuth::attempt($credentials , ['exp' => \Carbon\Carbon::now()->addDays(7)->timestamp] )
Apr
01
3 days ago
Activity icon

Replied to Pivot Table For Two Classes That Extend The User Class

/*Model*/
class Role extends Model
{
    /**
     * The users that belong to the role.
     */
    public function users()
    {
        return $this->belongsToMany('App\User');
    }
}

/*controller*/
$user = App\User::find(1);

foreach ($user->roles as $role) {
    echo $role->pivot->created_at;
}
/*Model*/
class User extends Model
{
    /**
     * The roles that belong to the user.
     */
    public function roles()
    {
        return $this->belongsToMany('App\Role');
    }
}

/*controller*/
$user = App\User::find(1);

foreach ($user->roles as $role) {
    //
}

$roles = App\User::find(1)->roles()->orderBy('name')->get();

Migration

2020_02_20_182537_create_userss_table.php
2020_02_20_182537_create_roles_table.php
2020_02_20_182537_create_role_users_table.php
Activity icon

Replied to Execute If The Condition Is False

public function check_vendor_vat()
    {
    	$vat_no = $this->vendor_company->vat_no;
        if (!empty($vat_no)) {
            return true;
        } else {
            return 0;
        }
    }



if($check->vendor_vat() == 0)
{
 //Execute Code
}
Activity icon

Replied to Limit API Access

/*installation Command*/
composer require barryvdh/laravel-cors	=>	/*v0.11.4*/

/*config/app.php*/ $providers
Barryvdh\Cors\ServiceProvider::class,

/*Publish barryvdh/laravel-cors package file*/
php artisan vendor:publish --provider="Barryvdh\Cors\ServiceProvider"

/*Use CORS Middleware*/	=>	/*app/Http/Kernel.php*/
protected $middlewareGroups = [
    'web' => [
       // ...
    ],

    'api' => [
        'throttle:60,1',
        'bindings',
        \Barryvdh\Cors\HandleCors::class,
    ],
];

protected $routeMiddleware = [        
        'cors' => \Barryvdh\Cors\HandleCors::class,        
];
Activity icon

Replied to CORS On Laravel 7

/*installation Command*/
composer require barryvdh/laravel-cors	=>	/*v0.11.4*/

/*config/app.php*/ $providers
Barryvdh\Cors\ServiceProvider::class,

/*Publish barryvdh/laravel-cors package file*/
php artisan vendor:publish --provider="Barryvdh\Cors\ServiceProvider"

/*Use CORS Middleware*/	=>	/*app/Http/Kernel.php*/
protected $middlewareGroups = [
    'web' => [
       // ...
    ],

    'api' => [
        'throttle:60,1',
        'bindings',
        \Barryvdh\Cors\HandleCors::class,
    ],
];

protected $routeMiddleware = [        
        'cors' => \Barryvdh\Cors\HandleCors::class,        
];
Mar
31
4 days ago
Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

@snapey sorry for disturb you... i have not concept so discuss with you..

Thanks alot for lot of helping..

Activity icon

Replied to Swagger Annotation Object Help !!!

This code can help you which you need

@SWG\Patch(
  path="/user",
  tags={"Security questions"},
  operationId="updateUsers",
  security={{"passport":{}}},
  @SWG\Parameter(
    name="body",
    required=true,
    in="query",
    @SWG\Schema(
        type="text",
    )
  ),
  @SWG\Parameter(
      name="users_id",
      required=true,
      in="query",
      @SWG\Schema(
          type="integer",
      )
  ),
  @SWG\Response(
    response="200",
    description="Security questions updated",
  ),
  @SWG\Response(
    response="202",
    description="User answers not filled",
  ),
)
Activity icon

Replied to Swagger Annotation Object Help !!!

@nader_look can you tell me that what you want with swagger where you stuck?

Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

@snapey Thanks dear brother for helping me

why i need to encode i have functionality when user will update picture then old picture delete from database and new picture will upload

private function deleteOldFile($request)
     {
        //check whether there is a new image in the coming requets
        $file = $request->file('profile_picture');
        if(!empty($file) && $file != null)
        {
            //remove image from user table
            $user = User::find(getApiUser()->id);
            if($user){
                $path = $user->profile_picture;

                $user->update([
                    'profile_picture' => ''
                ]);
                
                $fullPath = public_path()."/".$path;
                if(is_file($fullPath))
                {
                    unlink($fullPath);
                }
                
                $fullPath = public_path()."/".$path;
                // $fullPath = str_replace('profile-pictures/', 'profile-pictures/', $fullPath);
                
                if(is_file($fullPath))
                {
                    unlink($fullPath);
                }
            }
            return true;
         } else {
            return false;
         }
     }
Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

this working fine store database and fetch this is true?

$user_profile->profile_picture 	= asset($fullpath);
$user_profile->save();
Activity icon

Replied to Php Artisan Migrate:refresh Error

@tisuchi yes first delete all tables

composer dump-autoload
php artisan migrate
Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

so How can return user with this url where can i put asset functionality

https://imgur.com/hBtmGUO

$user = User::find($user->id); 
    	asset($user->profile_picture); 	
	        	    	  
        $msg = "Signing In.";
        $this->success($msg);
        $this->with('user', $user);

should i store with complete url in database because when user upate profile then what will functionality

Activity icon

Replied to Swagger Annotation Object Help !!!

/**
* @OA\Get(
*      path="/client/departments",
*      tags={"Client Departments"},
*      operationId="get",
*      summary="Get client departments",
*      description="Returns client departments",
*	   security={{"bearerAuth":{}}},
*      @OA\Response(
*          response=200,
*          description="Successful operation"
*      ),
* )
*/
public function get()
{
}

/**
* @OA\Post(
*      path="/client/departments",
*      tags={"Client Departments"},
*      operationId="post",
*      summary="Post client department",
*      description="Returns client department",
*	   security={{"bearerAuth":{}}},
*      @OA\Parameter(
*          name="name",
*		   required=true,
*          in="query",
*          @OA\Schema(
*              type="string",
*          )
*      ),
*      @OA\Parameter(
*          name="code",
*		   required=true,
*          in="query",
*          @OA\Schema(
*              type="string",
*          )
*      ),
*      @OA\Response(
*          response=200,
*          description="Successful operation"
*      ),
* )
*/
public function post()
{
}
Activity icon

Replied to Swagger Annotation Object Help !!!

/**
* @OA\Get(
*      path="/client/departments",
*      tags={"Client Departments"},
*      operationId="get",
*      summary="Get client departments",
*      description="Returns client departments",
*	   security={{"bearerAuth":{}}},
*      @OA\Response(
*          response=200,
*          description="Successful operation"
*      ),
* )
*/
public function get()
{
}

/**
* @OA\Post(
*      path="/client/departments",
*      tags={"Client Departments"},
*      operationId="post",
*      summary="Post client department",
*      description="Returns client department",
*	   security={{"bearerAuth":{}}},
*      @OA\Parameter(
*          name="name",
*		   required=true,
*          in="query",
*          @OA\Schema(
*              type="string",
*          )
*      ),
*      @OA\Parameter(
*          name="code",
*		   required=true,
*          in="query",
*          @OA\Schema(
*              type="string",
*          )
*      ),
*      @OA\Response(
*          response=200,
*          description="Successful operation"
*      ),
* )
*/
public function post()
{
}
Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

@snapey brother how can return this to api with response

this is my code give me some more help of you so i solve problem

$user = User::find($user->id); 
    	\Log::info( asset($user->profile_picture)); 	
	        	    	  
        $msg = "Signing In.";
        $this->success($msg);
        $this->with('user', $user);
Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

Yes @snapey i have the image path in database but problem is that frontend not now the where it is hosted

and in my .env APP_URL is http://localhost

Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

@snapey bro this not working for me

$user = User::find($user->id);
    	$url = asset($user->profile_picture);   
\Log::info($url)                      ===> get ``http://127.0.0.1:8000/  `` 		      	    	  
        $msg = "Signing In.";
        $this->success($msg);
        $this->with('user', $user);
        $this->with('token', $token);
Activity icon

Replied to Swagger Annotation Object Help !!!

what is error which you facing?

Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

private function uploadProfilePicture(Request $request)
    {
        try {
            $file = $request->file('profile_picture');
	        if(!empty($file) && $file != null)
	        {
	            $user = getApiUser();    
        		$user_profile = User::whereId($user->id)->first();

	            $fileExentsion              	= $file->extension();
	            $fileName                   	= $file->getClientOriginalName();
	            $fileFullName               	= time()."_".$fileName;
	            $path                       	= Str::slug($fileFullName).".".$fileExentsion;
	            $file->move(public_path('profile-pictures/'), $path);
	            $fullpath                   	= 'profile-pictures/'.$path;
	            $user_profile->profile_picture 	= $fullpath;
	            $user_profile->save();
	            return $fullpath;
	        }
        } catch (Exception $ex) {
            error_logs("An error occurred while uploading profile picture!");
        }
    }
Activity icon

Replied to How To Send Image Link From Laravel Storage To Frontend(angular)

Thansk for replying but i want to sent a complete url in end point include image path bcs front end dont know where it hosted

Activity icon

Started a new Conversation How To Send Image Link From Laravel Storage To Frontend(angular)

public function index(){
        $data = HeaderSlider::all();
        return $data;
    }

  <ul *ngFor="let item of data">
    <img [src]="item.image"  />
  </ul>
Activity icon

Started a new Conversation How To Send Image From Server To Client With REST API

how to send path from api in end point

when user logged in send profile image path

when udpate profile in response send new profile image path

Mar
30
5 days ago
Activity icon

Replied to How To Manage A Whole Get Function In Repository Design Patterns

i want to manage the index method in controller

public function index(Request $request)
    {        
        $projects = $this->project->get();
        $this->with('projects', $projects);       
        return response()->json($this->response, $this->responseCode);
    }

you can see above index method which i want to manage i have no concept plz give me best solution because i'm beginner in design patterns

Activity icon

Started a new Conversation How To Manage A Whole Get Function In Repository Design Patterns

Hi!

i have a function of get in controller which have many functionality how to manage this from repository patterns

plz give me the best solution so that i can manage this problem

Repository.php

namespace App\Repositories;

use Illuminate\Database\Eloquent\Model;

class Repository implements RepositoryInterface
{
    protected $model;

    public function __construct(Model $model)
    {
        $this->model = $model;
    }

    public function get()
    {
        return $this->model->get();
    }
}

RepositoryInterface.php

namespace App\Repositories;

interface RepositoryInterface
{
    public function get();

}

ProjectController

class ProjectController extends APIBaseController
{
    protected $project;

    public function __construct(Project $project)
    {
       // set the model
       $this->project = new Repository($project);
    }

   public function index(Request $request)
    {                 
        $user = getApiUser();
        if ( $user->hasRole('admin') || $user->hasRole('super-admin') ) {
            $projects = Project::all();

            $this->with('projects', $projects);       
            return response()->json($this->response, $this->responseCode);
        } else {
            $projects = DB::table('project_members')
                ->join('projects', 'projects.id', '=', 'project_members.project_id')
                ->where('project_members.user_id', '=', $user->id)
                ->get();
        }                      
                        
        $this->with('projects', $projects);       
        return response()->json($this->response, $this->responseCode);
    }
}
Mar
29
6 days ago
Activity icon

Replied to Can I Add A Unique Constraint Based On Multiple Columns

@amaury thanks brother for replying..

i want to add only name for a unique constraint based on multiple columns

value will different because i will fetch data with name in future

Mar
28
1 week ago
Activity icon

Started a new Conversation Can I Add A Unique Constraint Based On Multiple Columns

Hi!

Can anybody give me best solution that i want to save mutiple variables with same name but should also be unique so that other variables name do not override with same name functionality

slug functionality do not working because will data is overriding and conflict

e.g

https://imgur.com/g0gotsl

Activity icon

Replied to Can I Set A Unique Constraints On Two Columns?

Thanks @morcen for replying me..

like

ID name value

1 host asdkjfaklsfklajflkajflkdjaldjlkafj

2 host kajsdklfjas;kldfj;kljas;kldfjaskljfklasjfklj

3 host kasjdfkljaskljfa;klsdjflajfkljasfjalfjalfja;jf

Activity icon

Started a new Conversation Can I Set A Unique Constraints On Two Columns?

Hi!

Can anybody give me best solution that i want to save mutiple variables with same name but should also be unique so that other variables name do not override with same name functionality

slug functionality do not working because will data is overriding and conflict

e.g

MyMode::create(array('mytext' => 'test', 'user_id' => 1);
// this fails??
MyMode::create(array('mytext' => 'test', 'user_id' => 2);
Mar
27
1 week ago
Activity icon

Started a new Conversation Problem With Unique Field Validation On Update In Controller

store method

public function store(Request $request)
{
	$this->validateForm($request)
}

update method

public function update(Request $request)
{
	$this->validateForm($request)
}

validate method

private function validateForm(Request $request)
    {         

            'name' => 'required|string|max:255|unique:veriables',
            'value' => 'required',             

    }
Mar
26
1 week ago
Activity icon

Started a new Conversation How Can Update Jquery Append Data On Edit Page

Plz give me the best solution i have not concept and not finding the concept from last 2 days

i have a one form which including in create,edit file and in which some fields which appending with the help to jquery

appending successfully but are not update corrently when update or add multiple fields then again edit show only one input field

this is my code sample of edit page

controller

public function edit($id)
    {
        $projects       = Project::get();
        $collections    = Collection::get();
        $request        = RequestUrl::query()->findOrFail($id);
        $params         = Param::where('request_id', $request->id)->get();        
        return view('admin.requests.edit', compact('request', 'projects', 'collections', 'params'));                    
    }

edit.blade.php

			<div class="row">
	                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">                   
	                  	@include('admin.requests.partials._form', [
		                    'url' => route('admin.request.update', $request),
		                    'request' => $request,
		                    'params' => $params,
		                    'edit' 	  => true,
		                ])
	                </div> 
	              </div> 

@section('javascript')
	<script type="text/javascript">
   		$(document).ready(function(){

   			var i = 0;
		       
		    $("#addParams").click(function(){		   
		        ++i;	   
	        	$('#params').append('<div class="row"><div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><div class="form-group"><input type="text" name="params['+i+'][key]" class="form-control" placeholder="Key"></div></div><div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><div class="form-group"><input type="text" name="params['+i+'][value]" class="form-control" placeholder="Value"></div></div><a  id="remove" name="remove" class="action-icon  fa fa-minus-circle" style="margin-top: 10px;"></a></div></div>');		        
		    });	    	
		});	  	   
	</script>
@stop

form.blade.php

<div class="tab-pane fade in active" id="params" role="tabpanel" aria-labelledby="params-tab">
					<div>
						<a href="#addParams" id="addParams" name="add" class="action-icon  fa fa-plus-circle" aria-selected="false" style="margin-left: 16px;"></a>
					</div>
					@isset($edit) 
						@if($request->params)	
							@foreach($request->params as $param)							
							<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
								<div class="form-group">
									<input type="text" name="params['+i+'][key]" class="form-control" placeholder="Key" value="{{ $param->key }}">
								</div>
							</div>
							<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
								<div class="form-group">
									<input type="text" name="params['+i+'][value]" class="form-control" placeholder="Value" value="{{ $param->value }}">
								</div>
							</div>
							@endforeach
						@endif
					@endisset
				</div>
Mar
25
1 week ago
Activity icon

Started a new Conversation How To Set Jwt Token Expire Time

Hi!

I set the token expire time 7 days but not working

here is my code plz give me the best solution

JWTAuth::attempt($credentials , ['exp' => \Carbon\Carbon::now()->addDays(7)->timestamp] )
Mar
24
1 week ago
Activity icon

Started a new Conversation Laravel Design Pattern

I want to learn laravel design pattern what will be the best forum for learn design pattern in laravel

Mar
21
2 weeks ago
Activity icon

Replied to How To Put A Condition On Two Different Id In Jquery For Append

sorry @nuz thanks brother for replying

but hitting both

when click on one id of input class what will be condition on both only selected hit not another

Activity icon

Replied to How To Put A Condition On Two Different Id In Jquery For Append

@bobbybouwmann i want to put a condition on both id which are relate two different classes

when click on the #params id then only hit this input field not second #header id hit

Activity icon

Started a new Conversation How To Put A Condition On Two Different Id In Jquery For Append

Hi! I want to put a condition on two ids when click on one id then will not another create

This is my code plz give me the best solution

<script type="text/javascript">
   		$(document).ready(function(){

   			var i = 0;
		       
		    $("#add").click(function(){
		   
		        ++i;	   

		        if ($('#params')) {
		        	alert('params');
		        	$('#params').append('<div class="parent-div"><div class="row"><div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><div class="form-group"><input type="text" name="params[0][key]" class="form-control" placeholder="Key"></div></div><div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><div class="form-group"><input type="text" name="params[0][value]" class="form-control" placeholder="Value"></div></div><a  id="remove" name="remove" class="action-icon  fa fa-minus-circle" style="margin-top: 10px;"></a></div></div></div>')
		        }	

		        alert('header');
		        $('$header').append('<div class="parent-div"><div class="row"><div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><div class="form-group"><input type="text" name="header[0][key]" class="form-control" placeholder="Key"></div></div><div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><div class="form-group"><input type="text" name="header[0][value]" class="form-control" placeholder="Value"></div></div><a  id="remove" name="remove" class="action-icon  fa fa-minus-circle" style="margin-top: 10px;"></a></div></div></div>');

		    });
		   
		   	$(document).on('click', '#remove', function(){  
		         $('.parent-div').remove();
		    });	    	
		});	  	   
	</script>
Mar
18
2 weeks ago
Activity icon

Replied to How To Deal With "flash Messages" When Using An Api

@luddinus

public function with($variableName, $variable)
    {
        $this->response['data'][$variableName] = $variable;
    }

$this->with('post', $post);
               
return response()->json('200', 'Request completed successfully!');
Activity icon

Replied to How To Dockerize Php Laravel Application

Thanks @goldtaste bro for help me

Activity icon

Replied to How Can Make Custome Pagination For A List

I'm using simple keyword of pagination i have not concept of this type of pagination which i leave a link in above