brightstormhq

Senior Developer for Hire at Bristol

Experience

23,770

4 Best Reply Awards

  • Member Since 8 Months Ago
  • 202 Lessons Completed
  • 2 Favorites

19th September, 2018

brightstormhq left a reply on Laravel: Cache Store [predis] Is Not Defined In Illuminate\Cache\CacheManager.php • 6 hours ago

You’ll find the setting in config/cache.php

See https://laravel.com/docs/5.6/cache for docs

brightstormhq left a reply on Laravel: Cache Store [predis] Is Not Defined In Illuminate\Cache\CacheManager.php • 7 hours ago

youll want to set your cache method to ‘redis’ rather than ‘predis’

brightstormhq left a reply on How I Do Save In Two Db Table With Same Id • 19 hours ago

Can you add your model files so we can see the relationship between your two tables? I’m curious why you are saving records in 2 tables as you can get whether something is new by the rows updated date. 1900 records in a database isn’t very much. If you are having performance and issues because of this iron these out by reviewing your queries and using laravels eloquent methods to talk to the database and also lazy loading as appropriate.

brightstormhq left a reply on Composer • 19 hours ago

@davy_yg that’s correct.

17th September, 2018

brightstormhq left a reply on Seems Slow • 2 days ago

I’d look installing a debugging tool such as Tracy https://github.com/recca0120/laravel-tracy which should give you some details on where your bottle neck is. It could also be an issue with your DNS if you app takes ages to respond.

brightstormhq left a reply on Problem With Foreach On Update/save • 2 days ago

@petritr can you show your model so i can understand the relationship you've set up? Feels like (if you are using a join table) then you can use sync()

eg

$hub->data()->sync([1, 2, 3]);

16th September, 2018

brightstormhq left a reply on PHP Storm Laravel Integration • 3 days ago

The Phpstorm ide helper package should help here https://github.com/barryvdh/laravel-ide-helper

14th September, 2018

brightstormhq left a reply on Admin Panel • 5 days ago

Laravel backpack has a good crud builder for this purpose https://laravel-backpack.readme.io/docs/getting-started

brightstormhq left a reply on Problem With Foreach On Update/save • 5 days ago

It looks like your array is showing a hasMany relationship. Hub has many data. If you define this in your models and set up an appropriate table then eloquent will deal with the save for you. Look at https://laravel.com/docs/5.7/eloquent-relationships for info

brightstormhq left a reply on Modelling Data In Controller Results In: "htmlspecialchars() Expects Parameter 1 To Be String, Array Given" • 5 days ago

If you could post whats in your blade file. I suspect you are trying to echo an array.

11th September, 2018

brightstormhq left a reply on Query Is Takes Only First Id • 1 week ago

@mkrahamath you can simplify the above by just setting your

$productIds = [1,2,3,5,6,8];

You are initially declaring a string of numbers and then turning that into an array when you could easily already define the array in the first place

brightstormhq left a reply on Query Is Takes Only First Id • 1 week ago

If you are only getting one record when passing in the array, check you actually have products with those ids in your database.

Installing a package such as Tracy will give you access to queries you are running in your UI which will allow scrutinise what’s running at db layer https://packagist.org/packages/recca0120/laravel-tracy

brightstormhq left a reply on Query Is Takes Only First Id • 1 week ago

You’ve defined your product ids as a string before passing that string to your query and wrapping it in brackets. Just create the array of ids first, and pass that in.

4th September, 2018

brightstormhq left a reply on Sample • 2 weeks ago

Can you supply a bit of context / code for this question?

brightstormhq left a reply on Hey Guys. I Need Some Ideas. How Can I Use Javascript To Differentiate $ids Of Objects? • 2 weeks ago

What different thing do you want to happen? Something like a modal pop up or slideshow?

2nd September, 2018

brightstormhq left a reply on Sorry, The Page You Are Looking For Could Not Be Found Error • 2 weeks ago

I’ve not used the action helper instead preferring to create a route in routes.php and then reference the route in the form action. That way you can check the route is valid by running:

php artisan route:list

I think you also might need to post rather than put in your form method.

brightstormhq left a reply on Can't Get Select Value - Laravel 5.5 • 2 weeks ago

You’ll only get values in your $request object as a result of a form submission.

If you want to filter your select you’ll need to wrap it in a form and submit a t to you index method which will give you access to the appropriate value you want to filter on

27th August, 2018

brightstormhq left a reply on Create Vhost Apche2 • 3 weeks ago

Don’t forget you can also use the artisan serve to get a local development environment running without needing to touch apache.

brightstormhq left a reply on How To Recover .git Directory? • 3 weeks ago

If you still have the file changes, and the remote repo, just check the project out again and copy your new files over the old and you should see file differences.

Can you clarify what your mean when you say ‘I cant download it again’ - as in you can’t ‘git pull’?

brightstormhq left a reply on Problem With Vhosts • 3 weeks ago

You’ll also need to remove the comments on DocumentRoot so you can server files in the DocumentRoot

26th August, 2018

brightstormhq left a reply on Recommend Me A Laravel E-commerce Package • 3 weeks ago

The same question was asked last week - https://laracasts.com/discuss/channels/laravel/ecommerce-from-scratch

Assess why you want ecommerce first. If the motivation is to sell products as soon as possible, building an ecommerce solution (and maintaining it) in laravel isn’t the quickest way.

Start with something off the shelf (like shopify) and build up when you’ve got some commercial reason to do so.

24th August, 2018

brightstormhq left a reply on Show Relation Field On Resource Index • 3 weeks ago

If you have a relationship in User called roles(), then in your index blade, you just need to do the following:

@foreach($users as $user)
{{ $user->roles }}
@endforeach 

You’ll probably want to foreach through roles too to get $roles->name

brightstormhq left a reply on Gitlab • 3 weeks ago

You shouldn’t need to manually upload any files to a new repo. If you have created a new repo locally, by initially running ‘git init’ in your directory and then adding and committing, you should then set a remote

git remote add <remote-name> <url>

Using the path provided by gitlab.

Alternatively clone the remote directory into a new folder locally which will automatically set the remote for you.

22nd August, 2018

brightstormhq left a reply on Laravel Learinig • 4 weeks ago

Watch Jeff’s excellent introduction series to Laravel https://laracasts.com/series/laravel-from-scratch-2017

21st August, 2018

brightstormhq left a reply on Get Selected Value From Select On Change In Laravel • 4 weeks ago

if you are trying to display the value of the selected option further down the page you don’t need to use Ajax to do this as you can just get the option value using onChange and then set the value via $(‘#foo’).val(optionValue); where #foo is the element containing your php variable.

I’d suspect this is part of a bigger form which will be submitted to the server to store the value of your selected option which it will get from your element.

My advice would be to work out your form login before adding any jquery and then add your jquery as an enhancement to the view otherwise you’ll get caught up in the detail before core functionality is in place.

If you can post some more code including the contents of your blade file and related controller method this will give more context.

20th August, 2018

19th August, 2018

brightstormhq left a reply on File_put_contents(...): Failed To Open Stream: No Such File Or Directory - Always This Problem • 1 month ago

Your storage folder and all inside should have 755 file permissions. Make sure you add the the -R flag to recursively set inside folders.

brightstormhq left a reply on How To Change Default Webpack.mix Path? • 1 month ago

Are you running npm on your host machine or inside your vm?

18th August, 2018

brightstormhq left a reply on ECommerce From Scratch? • 1 month ago

I’d never recommend building ecommerce from scratch. If you really are starting from a clean slate, work out how many products you are planning on selling and build a solution around that. If you are in a hurry to start trading, an off the shelf pay as you go like shopify.com would be my recommendation. You can be up and running in a day and that will buy you some time to establish what you need. If you build custom, you are exposing yourself to a great deal of anguish regarding payment gateway integration, hacking and the like. Unless you have a specific need and are expert at building ecommerce then mitigate your risk by using someone else’s work.

brightstormhq left a reply on Statamic Vs. Laravel Nova • 1 month ago

A 3rd contender which acts as CRUD and both CMS is a product called backpack. https://backpackforlaravel.com Pretty straight forward to set up with no additional models required, Deals with user management and permissions too (using Spatie package for permissions)

brightstormhq left a reply on How Can I Combine All The JavaScript My Application Needs Into One File, App.js? • 1 month ago

You can use laravel mix for this - see documentation at https://laravel.com/docs/5.6/mix

brightstormhq left a reply on Best Way To Bisect Two Large Collections • 1 month ago

If you are only trying to show the items which are not new items, in which case do you only need 1 query where prepared =1?

If you are trying to exclude the new items from all items, then you can add a whereNotIn with an array of the ids you wish to exclude.

13th August, 2018

brightstormhq left a reply on Join Three Table And Get Specific Data • 1 month ago

@armancs you'd be better create the table with a migration file to make it easier to deploy your application.

I'm not sure how your question has changed but i can see the addition of

$countries->country->name

which won't get you anything as there isn't a relationship to country on your $country model.

If you can look at your question again and clarify then i'll have another go at answering,

brightstormhq left a reply on Join Two Table And Get Specific Data • 1 month ago

If you use standard Laravel table and field names you’ll have a much easier time getting this to work.

Firstly, your tables don’t need the _tbl suffix - they are already tables in a db.

Your tables can just be ‘countries’ and ‘ universities’

See https://github.com/alexeymezenin/laravel-best-practices/blob/master/README.md#follow-laravel-naming-conventions

Secondly, your ref_country_id should be just country_id. This way you don’t need to define the $fk. Also given you’ve already got region_id in that table, the region_id is also a foreign key so a variable named $fk isn’t the only one.

In your view, if you’ve got a single university you should be able to display the country as such

$country = $university->country->name;

Also, to follow convention, you don’t need to suffix Model onto the end of your model names. Follow conventions, and it’ll make all your dev easier (and much easier for others to debug).

12th August, 2018

brightstormhq left a reply on Customising Users Table • 1 month ago

Where are you storing your state_id and referencing your States data from?

11th August, 2018

brightstormhq left a reply on Customising Users Table • 1 month ago

@flowser first you need to ensure your model relationships correctly reflect what you are trying to achieve. You’ll waste a lot of time and brain working up your controller methods before you have done this mapping,

Let’s us see your User model and migrations and someone can help you with those.

brightstormhq left a reply on Form Submission • 1 month ago

@10minutemail what does your store method look like? Also check your route for store isn’t clashing with your route for index. You can do this by running artisan route:list

brightstormhq left a reply on Body Exceeds With Aside Tag • 1 month ago

@joffpascual can you add some code formatting into your post above as it’s hard to see what’s going on in your blade.

10th August, 2018

brightstormhq left a reply on Customising Users Table • 1 month ago

As @aurawindsurfing suggested, you need to extend your user model to add state_id and then set up as hasOne relationship with a new model called State. You’ll need to create a migration to d this, if you system is already in product or add the field to the User migration if its not. Should then be straight forward to receive the State name for the id.

brightstormhq left a reply on Where Are You All From? • 1 month ago

Just up the road from you in Bristol

8th August, 2018

brightstormhq left a reply on How To Get Last Id In Laravel? • 1 month ago

@Snapey I admire your persistence.

brightstormhq left a reply on How To Get Last Id In Laravel? • 1 month ago

To ensure you are acting on the current school, you should set the school_id as a hidden field in your form and then reference that within your store method. Alternatively, if your user has a relationship with a school then you can get this id via Auth::user()

brightstormhq left a reply on Laravel - E-Commerce - Suggestion • 1 month ago

I was looking for the same recently and have come across Aimeos https://aimeos.org/docs/Laravel - I’ve not installed but looks like a possible candidate for you.

brightstormhq left a reply on How To Get Last Id In Laravel? • 1 month ago

@chrisgo looks like @irankhosravi is already doing that in their return response()

7th August, 2018

brightstormhq left a reply on Retrieve Records Within Business Hours Only • 1 month ago

Ah. So order processing?

Assuming you are storing the processed_date, user_id, order_id then you could select all processed orders from this table and join this to the order table to get order created date which will give you a time elapsed since order creation.

Passing that through a method you could then check if order has taken longer than 8 hours to process and then you can test each start date if it’s weekend and trim the hours off accordingly.

Write some test cases to with static data to test what time you are expecting to return first as there will be cases eg. Record created on Friday evening, processed Monday. Record created Monday, processed Monday. Record created Monday midnight, processed Tuesday,

Whilst it may be possible to do this ‘all in the query’ It’ll be simpler if you initially write a unit test to build the method first,

brightstormhq left a reply on Retrieve Records Within Business Hours Only • 1 month ago

Can I delve a bit deeper into why you are needing to collect this data and what type of data this is? Eg is it data generated by staff for the business, during business hours? If the data is only important during operational hours you may find a time based restriction on writing the data to the table may be helpful so you only gather the info you need, rather than filter out 2/3 of it when you query.

6th August, 2018

brightstormhq left a reply on How To Get HTML Text First 100 Letters Without Affecting The Other Display? • 1 month ago

If you plan to use this abbreviated post_body elsewhere in your application, it would be worth defining this logic in your model and then calling it like a field.

eg in your Article Model

public function getAbbreviatedPostAttribute() 
{
 return str_limit(strip_tags($this->post_body),100,'...');
}

and in your blade you can call:


{{ $article->abbreviatedPost(); }}
 

brightstormhq left a reply on Show Your Editor Of Choice • 1 month ago

PHPStorm for me.

brightstormhq left a reply on MySQL Said: Can't Connect To MySQL Server On '127.0.0.1' (4) • 1 month ago

your homestead IP wont be 127.0.0.1. as that is localhost, not the ip of the vagrant box. look in the top of your homestead.yaml for the address.

brightstormhq left a reply on Albums Index • 1 month ago

Add a where(‘user_id’,Auth::user()->id) assuming you have a user_id column in your table.

Edit Your Profile
Update

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