Ravish

Ravish

Member Since 10 Months Ago

India

Experience Points
40,560
Total
Experience

4,440 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
235
Lessons
Completed
Best Reply Awards
20
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 9
40,560 XP
Oct
21
1 day ago
Activity icon

Started a new Conversation Webpack Error - Cannot Read Property 'thisCompilation' Of Undefined

I am using copy-webpack-plugin to copy my entire images folder from src to dist folder. I do not know what I am doing wrong. Can someone point it out?

snippet from webpack config

const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
    plugins: [
	 new CopyWebpackPlugin({
	      patterns: [{
	           rom: 'src/images',
	            to: 'dist/temp'
	        }]
	 })
    ]
}

npm error

TypeError: Cannot read property 'thisCompilation' of undefined
    at CopyPlugin.apply (/opt/lampp/htdocs/gitwithravish/node_modules/copy-webpack-plugin/dist/index.js:338:20)
    at Compiler.apply (/opt/lampp/htdocs/gitwithravish/node_modules/tapable/lib/Tapable.js:375:16)
    at webpack (/opt/lampp/htdocs/gitwithravish/node_modules/webpack/lib/webpack.js:33:19)
    at processOptions (/opt/lampp/htdocs/gitwithravish/node_modules/webpack/bin/webpack.js:335:15)
    at yargs.parse (/opt/lampp/htdocs/gitwithravish/node_modules/webpack/bin/webpack.js:397:2)
    at Object.Yargs.self.parse (/opt/lampp/htdocs/gitwithravish/node_modules/webpack/node_modules/yargs/yargs.js:533:18)
    at Object.<anonymous> (/opt/lampp/htdocs/gitwithravish/node_modules/webpack/bin/webpack.js:152:7)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Documentation link https://webpack.js.org/plugins/copy-webpack-plugin/

Oct
20
2 days ago
Activity icon

Replied to What Are Some Good Draggable Javscript Libraries?

@sinnbeck Please check the question again. I updated it. Sorry for keeping it confusing.

Activity icon

Replied to What Are Some Good Draggable Javscript Libraries?

@sinnbeck I aint using any frameworks as if now. I want to develop this using and js or vuejs library

Activity icon

Started a new Conversation What Are Some Good Draggable Javscript Libraries?

I want to create a draggable and resizable grid interface for vue components. Any suggestions for a Javascript library? (vanillaJS, vueJS or jQuery0.)

Example site

https://www.cryptotiles.io/?utm_source=github&utm_medium=web&utm_campaign=vue-grid-layout

Functionalities I am trying to build

  • Allow user to add a vue component to the workspace.
  • Allow him to drag and resize those components according to the grid
  • Save the state of the vue component and positioning of each components
  • Use the saved data to re render ui when user requests for it.
Activity icon

Replied to ErrorException Creating Default Object From Empty Value

Abhishek, I highly doubt if anyone will be able to understand your question. Your code does not make sense. @tykus asked a valid question that why are you reassigning $location variable? Does it belong to Attendancelocation or TimeEntry? What are you trying to establish and where exactly are you having a problem?

Please describe it properly.

Activity icon

Replied to What Is The Best Way To Use Nuxt Js And Laravel

@awadgorg I would recommend yout to watch this. It covers almost everything that you need to know in order to combine laravel and nuxt.

https://www.youtube.com/watch?v=xS4Om2ZSu2o&list=PLjCZ5YN4Hlacehn798-qep4yXDcL4oF-x

Activity icon

Replied to ErrorException Creating Default Object From Empty Value

Can you describe your issue properly abhishek?

Oct
19
3 days ago
Activity icon

Started a new Conversation How To Check What Middlewares A Particular Route Has?

I want to execute a condition if a route does not have any middlewares

Oct
18
4 days ago
Activity icon

Started a new Conversation Database Design : Timestamp Column Or Saperate History Table.

In case of database design requirement where it is required to record changes for records in an entity? For example,

-> Record changes the user make in his bank details

-> Price and quantity changes for a products.

As far as I know there are two possibilities here. I can add a timestamp column and add merge it with primary key. For example PRIMARY(product_id, timestamp). And another way is to create a product_history table.

What are the pros and cons of both approaches?

Oct
17
5 days ago
Activity icon

Replied to Database Design Tips For A Water Supply System.

@martinbean It make sense. But I am wondering wouldn't it be complicated if ever I need to run raw queries and joins to the database or while giving direct database access to third party ? There are chances that we might run into such situations. Since the entire design of polymorphic concept reply on eloquent API, wouldn't it be tricky and complex to work with the database where we cannot make use of existing eloquent models in our project ?

Oct
16
6 days ago
Activity icon

Started a new Conversation Database Design Tips For A Water Supply System.

I am working on a government project which involves building a backend logging and billing system for water supply management. Usually the government has two types of customers - Industries and colonies. My main concern is how to place these two types of customers in database.

The difference between these two customers is the information. For example, the industries need to provide more information such as GST number, industry code etc. And the charges for water usage are applied differently based on the customer type - colony or industry.

Now followings are some points I am considering before designing.

1 - If I use two tables for different customer types then it might be slightly difficult to implement single authentication system. I don't think that would be a good practice.

2 - If I place both customers in one table with a customer_type column, then there will be many NULL cells. For example colony customers do not need to give their GST number.

3 - There are many tables where the reference for a customer is required. For example in water_connections table. If I place both customers in different tables, then I will have to use concept of polymorphism in many tables.

I am hoping that one of you would suggest some good practices for such scenario.

Oct
05
2 weeks ago
Activity icon

Commented on Environment Management

When I we update the env file, will it also update the cache accordingly on the server? For example, what if I change the database details. Will it connect to the new database immediately?

If not then what is the best practice to update the env file on an ongoing release and also clear the cache so that the project make use of that env variables.

Activity icon

Commented on Health Checks And Rollbacks

On what basis the health is measured?

Activity icon

Commented on Health Checks And Rollbacks

Let's say I deployed version 1. Then I deployed version 2. Eventually the storage got populated and after that I am redeploying version 1. What will happen to the storage? Will it remain as it was or it will also revert back to how it was during the end of version 1?

Sep
25
3 weeks ago
Activity icon

Awarded Best Reply on General Error: 1366 Incorrect String Value: '\xE2?

That b before double quotes means it is a binary string, different from unicode strings.

Open the file in notepad++, select encoding to utf-8,save it as a new file and try again.

Sep
20
1 month ago
Activity icon

Commented on Squash A Massive Migrations Folder

The bass sound coming up while you type is annoying jeffrey...

Sep
07
1 month ago
Activity icon

Started a new Conversation Route Binding Accessing Old Table Name !

I renamed a table from offers to ppt_offers. I changed the $table property in model file as well

/**
     * The table associated with the model.
     *
     * @var string
 */
protected $table = 'ppt_offers';

I also executed the following commands

php artisan route:clear
php artisan config:cache
composer dump-autoload

Eloquent is working just fine. But when I try to bind models using route paramters, it is trying to access the table with old name offers.

Exception

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'vha.offers' doesn't exist (SQL: select count() as aggregate from offer where id = 1)*

Activity icon

Replied to What Are Some Good Resources To Learn And Read About Laravel ?

A curated list of awesome bookmarks, packages, tutorials, videos and other cool resources from the Laravel ecosystem.

https://github.com/chiraggude/awesome-laravel#codebases-for-reference

Sep
05
1 month ago
Activity icon

Replied to UI Looks Good

@automica I think he thought this thread type feedback is to GIVE feedback XD

Activity icon

Replied to UI Looks Good

Wondering how to earn best answer badge on this one 🤔

Activity icon

Replied to Laravel Error While Connecting To Mysql

Post code of .env and config/dabase.php files

Activity icon

Replied to Laravel 6, Godaddy Email Problem

Clear your cache

php artisan cache:clear
Aug
30
1 month ago
Activity icon

Replied to Render Component String

i passed a variable $html = "<x-alert></x-alert>" into my view and then printed it like this {{ $html }}.

Everything worked as expected for.

Aug
29
1 month ago
Activity icon

Replied to Render Component String

As @snapey suggested.

{{ htmlspecialchars("</x-alert>") }}
Activity icon

Replied to Render Component String

this will return compiled html

$html = view('component')->render();
Activity icon

Replied to Render Component String

Your question is unclear. Please explain properly. @tiagosimoes

Activity icon

Replied to Laravel Many-to-Many Relationship With 2 Databases?

-> You should have defined multiple database in your config/database.php file.

'mysql' => [
    'driver'    => env('DB_CONNECTION'),
    'host'      => env('DB_HOST'),
    'port'      => env('DB_PORT'),
    'database'  => env('DB_DATABASE'),
    'username'  => env('DB_USERNAME'),
    'password'  => env('DB_PASSWORD'),
],

'mysql_forum' => [
    'driver'    => env('DB_CONNECTION_SECOND'),
    'host'      => env('DB_HOST_SECOND'),
    'port'      => env('DB_PORT_SECOND'),
    'database'  => env('DB_DATABASE_SECOND'),
    'username'  => env('DB_USERNAME_SECOND'),
    'password'  => env('DB_PASSWORD_SECOND'),
],

-> Define $connection in the model that belongs to other database.

namespace App\ForumModels;

class User extends Model
{
    protected $table = 'users';
    protected $connection = 'mysql_forum';

    public function __construct(array $attributes = [])
    {
        $this->table = env('DB_DATABASE_2').'.'.$this->table;
        parent::__construct();
    }
}

After this define two user models. One for your database and one for forum database. Overwrite the connection and table name as suggested above for user model of forum database. @burano

Aug
27
1 month ago
Activity icon

Replied to Struggling With Unique Validation

'email' => 'unique:users,email,'.request()->get('id');

//or

`email` => Rule::unique('users')->ignore(request()->get('id'));

@senrab check out this thread.

https://laracasts.com/discuss/channels/laravel/validating-in-controller-on-update?page=1#reply=635320

Activity icon

Replied to Check Column Value Before Using Relations

@ahmedwaill Hey there. I have used something like this in my old projects but I do not remember the exact code. I am missing something but cannot remember right now. Though I will try to find my old project code and get back to you in 24 hours.

Join laravel's discord server and put the question there too... Hopefully you will get a reply there too.

Aug
26
1 month ago
Activity icon

Replied to General Error: 1366 Incorrect String Value: '\xE2?

That b before double quotes means it is a binary string, different from unicode strings.

Open the file in notepad++, select encoding to utf-8,save it as a new file and try again.

Activity icon

Replied to How To Retrieve A Different Name From A Database (For Multilanguage Site)

@michaloravec He needs to make this logic available for a very few columns. I feel sometimes its better to not get into too much perfection and use packages for such things.

Don't you think its a quick solution to just add a custom attribute in every model where the translation needs to take place? There is not a lot of code duplication and the code still remains organized and error free...

Activity icon

Replied to How To Retrieve A Different Name From A Database (For Multilanguage Site)

@dxiri If you define those custom attributes, one per each model, I don't think you will need to worry about column-not-found exception. Which code snippet are you using and where ?

Activity icon

Replied to Vue Select From Array, But Show Current Value As Selected.

damn how can I forget that ! silly..

Anyways good luck !

Activity icon

Replied to Vue Select From Array, But Show Current Value As Selected.

<option
	 v-for='emailType in types'
        :value='emailType.type'>
	v-text='emailType.type'
	:selected='emailType.type == email.type'
</option>

Now?

Activity icon

Replied to Vue Select From Array, But Show Current Value As Selected.

Check if there exists an option tag with value equals to this.email.type. Console the value of this.email.type and see whether it returns null or a value.

There is no rocket science to it, it should work. There must be some logical error.

Activity icon

Replied to Single Charge Payments With Stripe

@redlik A developer friend of mine has recently used stripe in a commercial project and I heard some good reviews about stripe and cashier package. You should use it for sometime and decide if its good for yourself !

Activity icon

Replied to Vue Select From Array, But Show Current Value As Selected.

You can select it using javascript/jQuery once you load types.

axios.get('/api/getContactTypes')
	.then(function (response) {

         	this.types = response.data;

		$('#emailType').val(this.email.type);

        }).bind(this));
Activity icon

Replied to How To Retrieve A Different Name From A Database (For Multilanguage Site)

@dxiri

public function getName()
{
    return (App::getLocale() == 'es') ? $this->name_es : $this->name;
} 

If you wish to set more than one translation column, then you can load value dynamically like this.

public function translateColumn($col)
{
	$locale=App::getLocale();
    	$column=$col.'_'.$locale;
    	return $this->{$column};
} 

You can also put this logic in accessor

protected $appends = ['translated_name'];

//accessor
public function getTranslatedNameAttribute()
{
    return (App::getLocale() == 'es') ? $this->name_es : $this->name;
}
Activity icon

Replied to Mail From Address - Gmail Alias - Not Working

@wxcaptain You welcome. Don't forget to close the thread.

Activity icon

Replied to Mail From Address - Gmail Alias - Not Working

@wxcaptain In dont know mane... It should work.

https://medium.com/@agavitalis/how-to-send-an-email-in-laravel-using-gmail-smtp-server-53d962f01a0c

Try this resource also. And clear your cache and try again. Also, MAIL_FROM_ADDRESS from your project environment if its not needed.

Activity icon

Replied to How To Remove @charset In The CSS File When Running Npm?

@snackpack I believe if you compile your files using npm run production, that line wont be added.

Activity icon

Awarded Best Reply on Creating Records Directly Into Cache File Driver ?

Use sqlite. It does not require server, Create an sqlite file in storage and connect to that. Migrate your database into that and use factories to create dummy data. @untymage

Activity icon

Replied to Templated Customer Portals Suitable For Cashier?

https://themeforest.net/item/metrica-laravel-admin-dashboard-template/26611839

I have personally used this template in two projects. It is one of the best in terms of look and feel, typography, resource file size. It comes in laravel version so you wont need to worry about organizing everything.

https://themeforest.net/item/vuexy-vuejs-html-laravel-admin-dashboard-template/23328599

This one is also a good template. It comes with laravel version and laravel+vue version. I have used both. Laravel + Vue version is really fast !

@suren97

Activity icon

Replied to Customer Portal Template

Please ask in a way that we can understand what you are looking for. Are you looking for a front end theme? What kind of customer? @suren97

Activity icon

Replied to Creating Records Directly Into Cache File Driver ?

Use sqlite. It does not require server, Create an sqlite file in storage and connect to that. Migrate your database into that and use factories to create dummy data. @untymage

Activity icon

Awarded Best Reply on Dynamic Log File Location Possible?

I would stick with custom monolog implementations @chrisan