at F9 Web Ltd.

Hire Me



10 Best Reply Awards

  • Member Since 3 Years Ago
  • 515 Lessons Completed
  • 3 Favorites

20th February, 2018

Robstar left a reply on Update / Delete Function Is Not Working In Resource Controller. • 20 hours ago

What does your form/html look like? Methods which change data (i.e. when you submit your form) require a different http method, as does the destroy endpoint.

If you run php artisan route:list you can see what routes you have and what http request each route responds to.

Robstar left a reply on React Component Not Show In Laravel • 20 hours ago

Does extending React.Component work? Pretty sure your error has something to do with es7 transpiling. Thankfully I don;t do too much React lately, it's all Vue :)

4th February, 2018

Robstar left a reply on 10 Second Back Button • 2 weeks ago

Eh? :)

Robstar left a reply on Polymorphic OneToMany • 2 weeks ago

Polymorphic relations allow a model to belong to more than one other model on a single association. For a project I'm working on at the moment I have a bannerable() relationship on several models, as each of those models can have associated banners.

I'm not sure on your exact use case (the type of relationship you'd need would vary) but if you're storing some form of "brick type" you'd maybe use an hasOne() relationship. As a house can have many doors a hasMany() might be required.

All really depends upon exactly what data you want to store :)

Robstar left a reply on Need Front-end Tip • 2 weeks ago

You could do with without Vue and just use plain JavaScript, although Vue would make it simpler.

With plain JavaScript/JQuery you'd use the same idea as some basic tabs and on click on the "team" button hide all "team" divs and then show the required div. Each team row would have an id of some type. It's really not too hard.

The Overwatch site you've cited does it slightly differently. They have list item with the class CardGroup-card which are the team logos. For each row of 4 teams there is a hidden list item with the class CardGroup-card CardGroup-card--full-width.

They then use a bit of JavaScript to populate the CardGroup-card CardGroup-card--full-width based upon the selection.

To make the page loader faster to the user they've also loaded content via Ajax from - I'd assume they're using some form of frontend library to construct the roster row from the api response.

1st February, 2018

Robstar left a reply on Stop Users Of Accessing Files In Uploads Folder • 2 weeks ago

Do you use a controller response to service files or are the files in the physical directory /uploads on your server? Are you using a filesystem driver?

Robstar left a reply on Updating Multiple Rows In A Table • 2 weeks ago

Is estimate_id within your e_papers table unique? If not, your query will update multiple rows. If that is the case, you need to add a a further restriction on the update.

Robstar left a reply on Laravel Dependency Injection : Perfomace And Architecture • 2 weeks ago

@abin12914 Are the entities not related in some way? I fso, you could get away with passing less variables to blade. If some of the entities are used for things like drop down you could look at loading those on the frontend using JavaScript.

27th January, 2018

Robstar left a reply on Need Help In Coverting Html Code To Text • 3 weeks ago

I'm sure @anandmainali5 assumes everyone is clairvoyant. At least give us something to go off. Ask a detailed question and you'll get faster and better answers.

22nd January, 2018

Robstar left a reply on How To Include If Condition In Select Option Make The Id Matches • 4 weeks ago

@Shawdow Your own business logic is down to yourself to be honest. You have already been given answer based upon your original question.

Whilst your question is worded pretty badly I think you're referring to something called a dependant / dynamic select, see

21st January, 2018

Robstar left a reply on Intended Not Working! • 4 weeks ago

The Laravel docs has an example, see


namespace App\Http\Controllers;

use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
     * Handle an authentication attempt.
     * @return Response
    public function authenticate()
        if (Auth::attempt(['email' => $email, 'password' => $password])) {
            // Authentication passed...
            return redirect()->intended('dashboard');

However, if using the built in auth this is all handled for you, you simply set a class variable, $redirectTo.

Robstar left a reply on Build Eloquent Structure Before Saving Everything At The End? • 4 weeks ago

As @bobbybouwmann suggested, you should use transactions here.

Laravel has x2 methods to handle this. The first is a closure based appraoch, as in the example that has been provided to you. If an exception is thrown within the transaction Closure, the transaction will automatically be rolled back. If the Closure executes successfully, the transaction will automatically be committed. You don't need to worry about manually rolling back or committing while using the transaction method.

If you require greater control and like to begin a transaction manually and have complete control over rollbacks and commits, you may use the beginTransaction method on the DB facade.


Robstar left a reply on Path For Ajax In Laravel • 4 weeks ago

@Thameera For things like this your ajax endpoint is clearly broken. In the first instance always try hard coding in your url and then working to a dynamic url.

Robstar left a reply on How To Parse 2gb Size XML File Using Low Memory • 4 weeks ago

@zahedkamal87 You need to stream the file as opposed to loading it all into memory at once.

Fortunately, I don't have to work with XML too often. However, the last time (~ 6 months ago) a large (~400 MB) XML file was forced upon me I used

18th January, 2018

Robstar left a reply on How To Parse This Api Data In Javascript • 1 month ago


17th January, 2018

Robstar left a reply on How To Parse This Api Data In Javascript • 1 month ago

No frills method:

let json = '{"result":true,"count":1}',
    obj = JSON.parse(json);


Robstar left a reply on How To Parse The Data In Javascript Using For Loop • 1 month ago

Code tags please :)

Robstar left a reply on Route Problem • 1 month ago

Adding some code for us to look at would be a good start, we're not clairvoyant :)

Robstar left a reply on Session Lifetime • 1 month ago

Ah apologies :)

Robstar left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 1 month ago

@pneves What are you talking about? Laravel, or any version of it, does not force you to use any specific JavaScript framework or place any limitation on what npm packages you can (wtf?). It has a few lines of boilerplate code purely as starting point.

This thread is so confusing.

Robstar left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 1 month ago

I've unfortunately just skimmed though most of this thread. It's gotta be the most silly discussion ever. Unless you're a beginner I have no idea how you can look at Laravel and claim it's forcing you to use Vue. Literally no idea. Laravel gives you a couple of lines of code as a starting point.

The answer to you rant is very simple. If you don;t like Vue simply take the whole 10 seconds it takes to remove it from the app.

Hell, Laravel 5.5 has the command php artisan preset none which removes all frontend presents.

I'm really confused / interested as specifically why you looked at Laravel and stated it forces Vue upon you.

In all the time you've invested in this thread you could have deleted those couple of Vie related lines of JavaScript setup and started writing your app in another JavaScript framework.

Robstar left a reply on How Do I Hide And Show A Bootstrap Modal With Vue 2? • 1 month ago

@Jake2315 Twitter Bootstrap fires several Jquery style events. You could hook into these assuming you add a ref="vuemodal" to your modal. i.e.

new Vue({
    // ...
      // Stuff
  mounted() {
    $(this.$refs.vuemodal).on("", this.onHidden)

However, I'd personally be looking at using some quality Vue Bootstrap components from the off. i.e.

Robstar left a reply on How To Store Complex Dates In Mysql • 1 month ago

What type of database are you using?

Robstar left a reply on Configure A Route To Point To A Php Url Like "/in.php" • 1 month ago

For option #2 have you tried without the physical PHP file in the public dir? I believe option #2 will only work if /public/in.php does not exist. Latter assumes you are using an unmodified Lumen .htaccess file.

In situations where I have a legacy url I'd prefer to migrate it into Lumen.

Robstar left a reply on Experience Issue. • 1 month ago

Why on earth are you liking your own answers? :)

Robstar left a reply on Laracasts Certification For College • 1 month ago

I've always thought these kind of things were a little pointless. ON LInkedIn I see people with hundreds of certificates. i.e. "JavaScript​: Functions", "JavaScript​ and Json", "Up and running withe command line". It seems a little pointless imo :/

Might be an idea to display completed series on your Laracasts profile though?

Robstar left a reply on Error In Array In View File • 1 month ago

@arslan2037 Please provide a full screenshot or paste of your json string. If you do this you'll get an answer much faster :)

Robstar left a reply on Session Lifetime • 1 month ago

@vandyczech I believe the "Jesus" was because @Snapey gave you the answer on a plate :)

The provided Laravel config. file literally states:

Here you may specify the number of minutes that you wish the session
to be allowed to remain idle before it expires. If you want them
to immediately expire on the browser closing, set that option.

Not sure how it can be any clearer than that?

Robstar left a reply on "Method [validateImages] Does Not Exist." • 1 month ago

@wamae FYI you can also enforce image dimensions now, see

Robstar left a reply on Using FormRequest To Power Routes • 1 month ago

@mdecooman Ah, that makes sense now :)

15th January, 2018

Robstar left a reply on Will Laravel Suit My Need ? • 1 month ago

If you have experience with other PHP Frameworks Laravel will speed up your workflow considerably.

Laravel has a basic member system built in by default - see - that's user login, auth, lost password and registration take care for you within a simple command.

You'll need maybe a further model (or two) to store additional user profile fielda dn address data. Again, really easy using Eloquent - Laravel's ORM - see

Sending emails, see - multiple drivers and very easy to setup.

The achievements will inevitable require some custom logic and multiple models. However, of you read up about Eloquent relationships, see, you'll see this is very easy.

After adding "achievements" you could handle them in Laravel in several ways:

As for the code that handles the achievements I'd recommend a simple service class that abstracts away that code.

Laravel has something called "migrations", see, that helps you essentially source control your database.

If this helps please mark the answer.

Robstar left a reply on How Do I Handle Multiple Submit Buttons In A Single Form With Laravel? • 1 month ago

What do you mean by a "Laravel" way? Your question is just simple HTML and basic PHP, all of which Laravel can handle. What code do you have so far?

Robstar left a reply on Using FormRequest To Power Routes • 1 month ago

Thanks for signing up to receive my Laravel tips! Here is a tip I've been using recently.
Supercharged Requests

I am a big fan of Laravel's form requests. Many people only utilize them for validation; however, I like to supercharge my requests by using them for some "GET" requests as well. Aside from validation, one of the primary benefits of form requests is that they allow you to add request specific methods directly into the request object. Often, this let's me simplify my route or controller code.

Let's consider an example. Imagine we are working on an application with a dashboard that lists a company's recent orders. On the right side of our order listing, perhaps we have some filters that you can apply to the listing. These filters would correspond to various "where" conditions the user could add to the order listing query via the filters. Perhaps one of the filters allows the user to show orders placed within the last 30, 90, or 180 days.

When making an AJAX "GET" requests to retrieve a fresh listing of orders based on the selected filters, we could Base 64 encode a JSON representation of the desired filters into the filters query string variable. Then, when we decode the filters on the server, we will end up with a JSON structure we can decode and apply to our query:

        "name": "order-age",
        "value": 30

Placing The Logic In A Route

Now, if we wanted to handle this in our route / controller, we could approach it like this:

use App\Order;
use App\FilterFactory;
use Illuminate\Http\Request;

Route::get('/', function (Request $request) {
    $query = Order::newQuery();

    $filters = json_decode(base64_decode($request->query('filters')), true);

    foreach ($filters as $filter) {
        $filter = FilterFactory::make($filter['name'], $filter['value']);
        $query = $filter->apply($query);

    return $query->get();

However, let's take a look at an alternative.
Place The Logic In The Request

Let's create an OrderSearchRequest and add a filters method to the request. Using this approach, we will leave the responsibility of the filter decoding and instantiation up to the request itself. We'll even return a Collection to make our code a little more expressive in our route:


namespace App\Http\Requests;

use App\FilterFactory;
use Illuminate\Foundation\Http\FormRequest;

class OrderSearchRequest extends FormRequest
     * Get the specified filters for the request.
     * @return Illuminate\Support\Collection
    public function filters()
        $filters = json_decode(base64_decode($this->query('filters')), true);

        return collect($filters)->map(function ($filter) {
            return FilterFactory::make($filter['name'], $filter['value']);

     * Determine if the user is authorized to make this request.
     * @return bool
    public function authorize()
        return true;

     * Get the validation rules that apply to the request.
     * @return array
    public function rules()
        return [

Once we have created our custom OrderSearchRequest, let's update our route code to utilize this new, powerful request object:

use App\Order;
use App\Http\Requests\OrderSearchRequest;

Route::get('/', function (OrderSearchRequest $request) {

    return $query->get();

Much cleaner! We leave the request parsing up to the request, and allow our controller to focus on the primary business logic of the request. I hope you enjoyed this tip. I look forward to sharing another tip soon!

Robstar left a reply on Using FormRequest To Power Routes • 1 month ago

@Snapey It's from Taylor's weekly newsletter of tips. It's a pretty good read. I'll paste in the on the OP is referring to.

Robstar left a reply on "Method [validateImages] Does Not Exist." • 1 month ago

Can you add the code :)

Robstar left a reply on LAravel SQL Optimization (Query, Cache, Etc) • 1 month ago

I had exactly the same issue when searching products/sites table (i.e. each site has many products). I had 16 sites and ~1.5 million products. Initially I was stuck at 30 seconds, which is no usable. I tried:

  • Indexing various tables, this brought the time down to 10 seconds, again far too long
  • Creating an optimized table for each site, that consisted of a product id and title (the column I wished to search upon). This knocked another 5 seconds from the time, but was far from ideal

Then I came across the excellent TNT Search Scout Driver, that brought the query down to < 3 seconds. This is so fast because it creates an optimized search index that is a flat sqlite file. You get all the benefits of speed and fuzzy matching, typos, did you mean functionality etc.

If you're querying using Mysql's "LIKE" operator, that is basically the slowest way to search. For your query, I'd recommend using the select($cols) function so columns that are not required are never queried or returned. I believe pluck() will simply filter the already returned collection down to a single column.

Robstar left a reply on How Do I Handle Multiple Submit Buttons In A Single Form With Laravel? • 1 month ago

Have multiple submit buttons, with the same name, but different values for each. You could run some form of switch or if statement within your form handler class. This isn;t specific to Laravel.

3rd January, 2018

Robstar left a reply on Why Should I Create Symbolic Link In Laravel • 1 month ago

In case anyone finds this useful, here is the Laravel docs link that discussing symlinking the public disk -

Robstar left a reply on Can I Compare Excel And Database Data While Importing And Highlight The Different? • 1 month ago

@dreamxyz The Laravel docs is very clear on the diff() function.

If you wish to highlight individual new rows you'll need to loop through the Excel collection and compare each row to the database collection - there are a plethora of collection methods to assist with this discussed in the Laravel docs.

I did do something similar this a few weeks ago. After discussion with my client they went with just showing new records before importing data. This made more sense for my use case as each import contain several thousand rows.

Robstar left a reply on Upgrade Php Version • 1 month ago

Are you using Cpanle to manage PHP versions? I know later versions allow to switch between PHP 5 and 7 via their UI.

As for your .htaccess file I'd personally try commenting out the line:

AddType application/x-httpd-alt-php56___lsphp .php .php5 .phtml

30th December, 2017

Robstar left a reply on Session Lifetime • 1 month ago

Wow :/

20th December, 2017

Robstar left a reply on Laravel Ajax • 2 months ago

@iamviraj Kudos for researching a solution yourself.

Robstar left a reply on Update Scout Index On Cascade Deleted Models • 2 months ago

If you're having issues it may be worth setting up model observers and calling the unsearchable() method as necessary.

Robstar left a reply on Fuzy Search In PHP • 2 months ago

@xmarks Your implementation is fine for small projects. However for anything else it lacks badly. You may find useful.

Robstar left a reply on Fuzy Search In PHP • 2 months ago

@ultrasamad Go with Laravel Scout and the tntsearch driver.

Robstar left a reply on Undefined Variable: Newsletter • 2 months ago

@muazzamazaz The error is very descriptive. The updated code type hints the argument.

protected function create(Request $request)

Originally you type hinted and array.

19th December, 2017

Robstar left a reply on Forge, Where Is The "deployment Script" ? [Horizon] • 2 months ago

@Xation In Forge click on a server and then on a site. The top box box as a green "Deploy now" button. The second box has a text area to edit the deployment script.

Robstar left a reply on Undefined Variable: Newsletter • 2 months ago

@Snapey @bobbybouwmann I've also thought this forum needs some type of visible sticky that provides guidance on asking good questions - similar to StackOverflow

In this case, adding some context, not simply pasting in a random block of none formatted code and maybe splitting files up into code blocks would have helped a lot. Seeing questions like this doesn't particularly motivate me to answer them :/

Robstar left a reply on Undefined Variable: Newsletter • 2 months ago

@muazzamazaz Yuu're getting that error because you are not using the code provided to you. The error states exactly the issue i.e. you're using a variable called $newsletter that is not defined anywhere.

Also note when you use return in a function the code below that will not get executed. So in your function:

protected function create(array $data)
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            'newsletter' => $newsletter 
    $user = User::create($request->all());
        flash('Please confirm your email address.');
        return redirect()->back();

the line starting with $user = will never be reached.

Robstar left a reply on Why Do People Like Whoops? • 2 months ago

@warmwhisky Open the cached file in your IDE - you can usually get an idea where the error in the original view file exists.

If you have an error relating to an invalid arg. in a foreach do you have data? For example, if the $posts variables was empty in the below blade file you'd see the same error:

@foreach ($posts as $post)

The same would apply if you're looping of a relationship like $user->posts.

Edit Your Profile

Want to change your profile photo? We pull from