Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

lorvent

Hire Me

Experience

13,025

5 Best Reply Awards

  • Member Since 3 Years Ago
  • 115 Lessons Completed
  • 10 Favorites

30th August, 2017

lorvent left a reply on Laravel 5.5 Syntax Error, Unexpected '?' In ..\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php On Line 233 • 3 months ago

if php7 is not running then it wont install at all as composer has that requirement.

30th July, 2017

lorvent left a reply on Session Data Into Repository __constrct Method • 4 months ago

can anyone know solution for this?

22nd June, 2017

lorvent left a reply on Is It Good To Use Sentinel For Authentication? • 5 months ago

i use it in almost all of my laravel projects and its advanced than laravel auth (not sure about latest version)...i am using it from laravel 4.2 days

lorvent left a reply on Deploying A Laravel Project. • 5 months ago

also did you chmod storage folder?

lorvent started a new conversation Repo Pattern Really Worths? • 5 months ago

We worked on a big project with 50+ repos, controllers etc.

Looking at the code, i am wondering...does repo pattern really worths the extra work?

PS: i want to hear from people who used it extensively.

-- my only positvbe point for it is....when creating controllers for web and api....instead of duplicating code, you can fetch from repo pattern.

lorvent started a new conversation Session Data Into Repository __constrct Method • 5 months ago

As of laravel 5.3....session data will not be passed to constructor as per https://laravel-news.com/controller-construct-session-changes-in-laravel-5-3

there is a workaround to this for controller.

But, how can i get a work around for it in Reposiroty?

my original problem: I am using sentinel so want to get current logged in user info inside construct method so that it can be used everywhere in RepositoryEloquent file.

is there any elegant way to get that done in laravel 5.4?

thanks

21st June, 2017

lorvent left a reply on Composer Problem Laravel 5.4 And Omnipay/paypal:~2.0 • 5 months ago

it worked for me :+1:

10th May, 2017

lorvent left a reply on Select Data With Escaped Output • 7 months ago

Thanks for the reply @bunnypro can you please give some hint on it?

lorvent started a new conversation Select Data With Escaped Output • 7 months ago

Hello, i have query like this

$data = Model::all();

the problem is, one row has code like <script>alert('boom')</script>

so instead of executing javascript code, i want to escape the data.

is there any such option available with eloquent?

Note: this data is being sent through ajax so i can't use blade escape feature.

9th April, 2017

lorvent left a reply on Bootstrap 4 Vs Bulma Vs Foundation With Laravel & Vue Js • 8 months ago

i personally prefer bulma, eventhough we built more than 100 websites using bs3

another plug thing is, there is something called vue-bulma

23rd March, 2017

lorvent left a reply on Can I Keep Using Elixir/Gulp After Migrating To Laravel 5.4? • 8 months ago

yes, in package.json add elixir

npm install laravel-elixir --save

and remove mix from package.json

then remove webpack.mix.js and add your old gulpfile.js

2nd February, 2017

lorvent started a new conversation Problem Installing Laravel 5.1 • 10 months ago

Hello,

installing laravel 5.1 throwing composer error with illuminate/support being not compatible.

anyone else facing same issue and found any fix?

26th January, 2017

lorvent left a reply on Applying Scoped CSS For Dynamic Content Using Vue-loader • 10 months ago

Bumping this thread

lorvent left a reply on Laravel 5.4 Dev Npm Run Dev Error • 10 months ago

removing node_modules and installing again with new package.json works for me too.

25th January, 2017

lorvent left a reply on Laravel 5.4 Dev Npm Run Dev Error • 10 months ago

@JeffreyWay it has default code

const { mix } = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');

lorvent left a reply on Laravel 5.4 Dev Npm Run Dev Error • 10 months ago

after following those 2 steps, now my npm run dev running

but throwing another error

> cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
                                                                           73% optimizeD:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\index.js:246
                                var shouldExtract = !!(options.allChunks || chunk.isInitial());
                                                                                  ^

TypeError: chunk.isInitial is not a function
    at D:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\index.js:246:55
    at D:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\node_modules\async\dist\async.js:3025:16
    at eachOfArrayLike (D:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\node_modules\async\dist\async.js:941:9)
    at eachOf (D:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\node_modules\async\dist\async.js:991:5)
    at Object.eachLimit (D:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\node_modules\async\dist\async.js:3089:3)
    at ExtractTextPlugin.<anonymous> (D:\xampp\htdocs\josh_laravel54\node_modules\extract-text-webpack-plugin\index.js:244:10)
    at Compilation.applyPluginsAsync (D:\xampp\htdocs\josh_laravel54\node_modules\tapable\lib\Tapable.js:71:13)
    at Compilation.seal (D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:525:7)
    at Compiler.<anonymous> (D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compiler.js:397:15)
    at D:\xampp\htdocs\josh_laravel54\node_modules\tapable\lib\Tapable.js:103:11
    at Compilation.<anonymous> (D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:445:10)
    at D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:417:12
    at D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:332:10
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:52:16
    at done (D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:246:17)
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:44:16
    at errorAndCallback (D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:202:5)
    at errorOrWarningAndCallback (D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:225:13)
    at D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\Compilation.js:229:12
    at onDoneResolving (D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\NormalModuleFactory.js:29:20)
    at D:\xampp\htdocs\josh_laravel54\node_modules\webpack\lib\NormalModuleFactory.js:85:20
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:726:13
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:52:16
    at done (D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:241:17)
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:44:16
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:723:17
    at D:\xampp\htdocs\josh_laravel54\node_modules\async\lib\async.js:167:37
    at D:\xampp\htdocs\josh_laravel54\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:24:19
    at onResolved (D:\xampp\htdocs\josh_laravel54\node_modules\enhanced-resolve\lib\Resolver.js:38:18)
    at D:\xampp\htdocs\josh_laravel54\node_modules\enhanced-resolve\lib\Resolver.js:127:10

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Seenu\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v6.9.4
npm ERR! npm  v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script 'cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\xampp\htdocs\josh_laravel54\npm-debug.log

looks like mix is immature yet,

anyone recommend using gulp/elixir or stick to mix and wait till bugs fixed?

thanks

10th September, 2016

lorvent left a reply on 5.3 Image Validation Only If Image Is Uploaded • 1 year ago

not working either :(

lorvent left a reply on 5.3 Image Validation Only If Image Is Uploaded • 1 year ago

that makes image required, i want image to be optional and if its uploaded then it should have only allowed extensions.

9th September, 2016

lorvent started a new conversation 5.3 Image Validation Only If Image Is Uploaded • 1 year ago

In 5.3, How can i validate an image only if its uploaded.

a rule like 'pic_file' => 'mimes:jpg,jpeg,bmp,png|max:10000', would validate pic_file only if its uploaded in 5.2

but in 5.3, i am getting error as image extension is wrong eventhough i didn't upload image.

how can i make validation optional? or how i can add a rule dynamically in Requests (not in controller)

Thanks.

27th August, 2016

lorvent left a reply on [?bug] Nested Relationships Error • 1 year ago

yes but thats a big burden on server as my db size may grow fast.

26th August, 2016

lorvent started a new conversation [?bug] Nested Relationships Error • 1 year ago

I Have Item model ItemCompetitor model with Item hasMany 'ItemCompetitorSales` model with ItemCompetitor hasMany

now, when showing single item i want to get last 2 rows of ItemCompetitorSales for each ItemCompetitor

so my ItemCompetitor looks like this

public function sales()
    {
        return  $this->hasMany(ItemCompetitorSaleCount::class,'item_competitor_id','competitor_id')
            ->orderBy('created_at','desc')
            ->take(2);
    }

So lets say for item = 1, there are 10 competetirors, each competitor has 5 competitor sales so i want to get 10 x 2 = 20 rows from ItemCompetitorSale model

but i am getting only 2

if i change take(2) to take(20) it returns 20 rows but again 5 rows from each for first 4 competitors which is not what i want.

Is this a possible bug with laravel or am i doing wrong?

5th August, 2016

lorvent left a reply on When Would You Update The Laravel Framework In A Project? • 1 year ago

I have upgraded projects from l4 to l5 because its a major change and some clients still running l4 happily.

usually i get tempted and move personal project to latest version but honestly i don't see any benefit.

if i want to utilize a new feature, again its extra work (assuming your old code is working properly already)

so currently my strategy is sticking to LTS (everywhere not just with laravel but also with system OS) if a new LTS version comes and your app still used by people then go for it.

if its a client project, upgrade as many times as client wants :D

lorvent left a reply on Odd Domain Redirecting To My Site. • 1 year ago

it happened to me just today,

i had a vps with DO long before and i have a sub-domain pointing to it after client work is over, i destroyed my droplet

today, i am collecting my portfolio and when i typed that domain ( i forgot i destroyed droplet) its showing someone else site, i was surprised a bit first then realized what is going on.

mine is opposite story of what you are experiencing.... so mostly it may be their mistake (unknowingly).

lorvent left a reply on Laravel 5.3 Failing On Gulp Watch • 1 year ago

laravel-elixir v6 is still buggy as @JeffreyWay making breaking changes.

whenever i try v6 (because of beautiful terminal output) i encounter problems and usually goes back to v4

29th July, 2016

lorvent left a reply on Testing: Get Contents Of A File • 1 year ago

Thanks @ohffs

lorvent started a new conversation Testing: Get Contents Of A File • 1 year ago

Hi, I want to automate testing for following task.

I want to open say routes.php and check for contents, see xyz and don't see abc

can anyone tell me how to do that?

thanks.

27th July, 2016

lorvent left a reply on Laravel CI Testing With GitLab • 1 year ago

currently i am using something like envoyer for live deployments on each commit, can we do same with gitlab ci?

lorvent left a reply on A Few Laracasts Things I Would Like Clearing Up • 1 year ago

for #1, checkout https://github.com/REBELinBLUE/deployer same as forge/envoyer but open source

lorvent left a reply on Laravel Task Scheduling From Database • 1 year ago

Thanks, i will try this and update the post.

26th July, 2016

lorvent left a reply on Laravel Task Scheduling From Database • 1 year ago

if i have 100 subscribers and each subscriber sets their own time, i can't make use of javascript

lorvent started a new conversation Laravel Task Scheduling From Database • 1 year ago

Hi, I am building a service where people can register to fetch API at regular intervals like 5mins, 15mins etc

and since every person uses a different schedule, i can't manually write all scheduling into kernel.php

is there any way to utilize database for task scheduling?

any help is appreciated.

18th July, 2016

lorvent left a reply on Get Distinct Dates Data • 1 year ago

lol ok

lorvent left a reply on Get Distinct Dates Data • 1 year ago

I am also thinking, is it better to store created_at (or other field) in just Y-m-d format so that i can get unique values easily?

lorvent left a reply on Best Place To Store API Methods • 1 year ago

I am making a connect to an API, there are 50+ methods.

i make around 10 methods from each controller.

currently, i wrote a wrapper method to make calls and put it in my base controller, so i am making calls with $this->method()

lorvent left a reply on Get Distinct Dates Data • 1 year ago

@willvincent @jimmck can you help me write eloquent code for that max? instead of raw queries

my current code looks like this

$arr = [];

        $competitor = Competitor::findOrFail($id);
        $competitorData = CompetitorSaleCount::where('competitor_id',$competitor->id)
            ->get();
        foreach ($competitorData as $competitorDataObject) {
            $newArray = [];
            $newArray[] = $competitorDataObject->created_at->format('Y-m-d');
            $newArray[] = $competitorDataObject->sales;


            array_push($arr, $newArray);
        }
//        return collect($arr)->unique()->values();
//        return array_unique($arr,SORT_REGULAR);
        JavaScript::put([
            'foo' => 'bar',
            'user' => 'seenu',
            'age' => 29,
            'data' => collect($arr)->unique()
        ]);
        return view('admin.competitors.show', compact('competitor','competitorData'));

16th July, 2016

lorvent left a reply on Get Distinct Dates Data • 1 year ago

@willvincent exactly, when searching for a user records,

  • i want to get only one record per day (as per created_at column)
  • which is most recent

so on a day, if we have 3 rows, i want to pick only one.

Currently, i found a workaround for it

  1. get all data from database
  2. store it into new array while formatting created_at to Y-m-d format
  3. applying array_unique($final_array,SORT_REGULAR)

so that i am getting only one row per day.

but this is not efficient because i am getting all rows from database...

lorvent left a reply on Best Place To Store API Methods • 1 year ago

@d3xt3r Currently i am doing that approach only but want to know, is there any better option.

lorvent left a reply on Get Distinct Dates Data • 1 year ago

i mean, how?

what is the syntax?

lorvent started a new conversation Get Distinct Dates Data • 1 year ago

I have a table where lets say i have following data

| id | user_id | value | created_at | updated_at | |---|---|---|---|---| |1 | 1 | 1329 | 2016-07-16 21:37:54 | 2016-07-16 21:37:54 | |2 | 2 | 860 | 2016-07-16 21:37:55 | 2016-07-16 21:37:55 | |3 | 1 | 1329 | 2016-07-16 21:38:53 | 2016-07-16 21:38:53 | |4 | 2 | 860 | 2016-07-16 21:38:53 | 2016-07-16 21:38:53 | |5 | 1 |1329 |2016-07-16 21:39:06 |2016-07-16 21:39:06| |6 | 2 |860|2016-07-16 21:39:06|2016-07-16 21:39:06|

Now, i want to get user_id 1's data but i want to get only one for each date but here for 2016-07-16 i have 3 rows, i want to select only one.

can i anyone guide me, how to get that?

thanks.

lorvent left a reply on Best Place To Store API Methods • 1 year ago

Thanks Saeed, yes Traits looks like good location, but i am confused with too many options :( like traits, repositories

lorvent started a new conversation Best Place To Store API Methods • 1 year ago

I want to make many API calls and it comes to around 50 methods, whom i am going to use in many Controllers,

so i am wondering what is the best place to store all those methods?

thanks.

9th July, 2016

lorvent started a new conversation Remove Timezone Difference Before Saving Into Db • 1 year ago

Hello, I get datetime from API like 2015-04-11T23:20:39+10:00 where +10:00 is timezone

I want to store data in UTC only i.e. remove 10hours from API timezone.

so that i can show data properly to user.

Can anyone tell me how to do that?

Currently, i am doing something like below without any luck

$timezone = new \DateTimeZone('UTC');
            $status = ItemSale::firstOrNew([
                'item_id' => $item_id,
                'sold_at' => Carbon::createFromFormat('Y-m-d\TH:i:sP',$row->sold_at,$timezone),
            ]);

Thanks.

15th June, 2016

lorvent left a reply on Sublime Text 3 Syntax Highlight • 1 year ago

preferences->color scheme->material theme and choose a theme

16th May, 2016

lorvent left a reply on Delete Cache On Save/update • 1 year ago

Excellent explanation @nickwest thanks for taking your time to explain it so nice

@rsdev000 thanks for the links, actually i mean those event fires only....since they are fired automatically, i can clear cache.

ofcourse i already have a cache clear route, which i hit whenever i feel something wrong going on.

lorvent left a reply on Delete Cache On Save/update • 1 year ago

Currently i am deleting cache in store and update methods but i guess there must be an elegant way using model listeners, events etc.

lorvent left a reply on Delete Cache On Save/update • 1 year ago

Sorry, that doesn't answer my question.

i know Cache::flush(); but i want a way to delete cache only when a new row is inserted or existing row updated for certain tables/models.

lorvent left a reply on Column Name And Relationship Name Same • 1 year ago

Hi, Thanks for the response.

I already have some other user columns so this one has to be a different, ofcourse i can append _id to make it something like edited_by_id() as relationship name.

$model->edited_by()->first_name is not working, its throwing some other error.

lorvent started a new conversation Column Name And Relationship Name Same • 1 year ago

Hello,

Can i have column name and relationship name same?

ex:

I have a column edited_by in Abc.php model

and i want to get full details of user mentioned in edited_by from users table so i have relationship like below

public function edited_by(){
        return $this->hasOne('App\User','id','edited_by');
    }

now, if i try to access $model->edited_by->first_name its throwing error 'trying to get property of non-object'

is there any way to fix it other than having different names?

lorvent started a new conversation Delete Cache On Save/update • 1 year ago

Hello,

I have around 20 models and since i need to get data from many models for each request, i am saving them into cache.

Now, if a user creates/updates any record into those cached models, i want to flush cache.

is there any proper way to do it? like using events, model listeners etc?

Thanks.

25th April, 2016

lorvent left a reply on Laravel 6 • 1 year ago

I really wish 5.3 will be LTS and will be around for a long time utilizing php7 features

Edit Your Profile
Update

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