chrisgeary92

chrisgeary92

Member Since 5 Years Ago

Dunstable, UK

Experience Points
60,880
Total
Experience

4,120 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
429
Lessons
Completed
Best Reply Awards
48
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 13
60,880 XP
26 Apr
1 year ago

chrisgeary92 left a reply on DB Schema - Conditional Many To Many?

Thanks to both of you! .. It was really interesting to read about Event Sourcing, and is something I am going to look into a bit more.

Nice idea with the history table, It seems similar to the Event Sourcing idea, but potentially a simpler implementation of it if I understand it correctly.

Thanks again for the help :)

chrisgeary92 started a new conversation DB Schema - Conditional Many To Many?

Hey!

I need to store the venues of a given team for a sports league statistics project.

  • A team can only have 1 venue at a time. But they can change venue.
  • A venue can have manyteams at one time.

All historical data needs to be kept intact in order to calculate statistics for previous years, so I cannot simply update IDs as this will of course affect the previous years data.

Am I right in thinking I can make this many-to-many between a venue and a team, and include additional columns containing dates to show when a team started and ended at that particular venue?

I need to do similar for players in a team.

  • A player can join or leave at anytime
  • They can play for multiple teams
  • Their shirt "number" can change each season

And many others. There are quite a lot of variables that can change most of which are date or season dependant, and I'm wondering if this is appropriate for lots of columns in a pivot table, or if there is a more appropriate solution?

I'm wondering if anyone has suggestions for other ways to do this, or to just validate my idea is correct etc.

Thanks in advance for any help.

10 Oct
2 years ago

chrisgeary92 left a reply on Reverse Polymorphic ORDER BY W/ Eloquent (L 5.2)

Thanks @bashy, I've just tested this but it doesn't seem to work. It orders the accounts when they're attached but not the assistants/users based on the accounts values. Hopefully that makes sense.

This is what it has produced:

select * from `assistants` where (select count(*) from `accounts` where `accounts`.`accountable_id` = `assistants`.`id` and `accounts`.`accountable_type` = 'Assistant' and `accountable_id` in ('5737', '13699')) >= 1 limit 10 offset 0

select * from `accounts` where `accounts`.`accountable_id` in ('5737', '13699') and `accounts`.`accountable_type` = 'Assistant' order by `last_login` asc

But I need the last_login joined to assistants, so i can order all of the results by that value. Or am I doing this wrong? :P

This is what I have:

$ids = [ ... ];

$search = new \App\Assistant;

$results = $search->with(['account' => function ($s) {
    $s->orderBy('last_login');
}])->whereHas('account', function ($s) use ($ids) {
    $s->whereIn('accountable_id', $ids);
})->paginate(10);
07 Oct
2 years ago

chrisgeary92 started a new conversation Reverse Polymorphic ORDER BY W/ Eloquent (L 5.2)

Hi all.. I'm stuck with an eloquent issue I was wondering you could help out with.. My table structure is below:

accounts
id, last_login, accountable_id, accountable_type

users
id, name

assistants
id, name

I need to query the users table but order by the last_login from accounts. The User and Assistant eloquent models have a method called account for the reverse polymorphic relation.

This is was I currently have:

$search = $search->with('account')->whereHas('account', function ($s) use ($ids) {
     $s->whereIn('id', $ids);
})
->orderBy('account.last_login')->paginate(10);

Thank you in advance :)

17 Jun
3 years ago

chrisgeary92 left a reply on Slow Eloquent Query

Remove ->get(); that is trying to return you multiple rows (not the first)

Also, is your name field indexed?

chrisgeary92 started a new conversation Eloquent Resets Some Columns Stored As $dates To NOW()

Anyone else had a problem with Eloquent dates and Forge before?

I have a project that works fine on homestead, but when it's put onto forge one of the date fields (a custom fields I made called starts_at) doesn't save correctly if it's not a dirty value. It's odd, because I have an ends_at field which works fine. The code is the same for both.

I have narrowed it down as far as Eloquent save() method.. The correct dates are being parsed into fill() and if I dump out the attributes of the model after using fill() they are correct. However when I save the model, if the starts_at column has not changed from what is in the database it will save the current date/time. But this only happens on starts_at and not on my ends_at column.

Any ideas? I can't replicate this on homestead as it saves correctly, I only have the issue on Forge (using Envoyer for deployments).

Model:

protected $fillable = [
        'user_id', 'slug', 'name', 'description', 'starts_at', 'ends_at'
];

protected $dates = [
        'starts_at', 'ends_at'
];

Code for the update:

(the $starts_at and $ends_at carbon objects are fine, they contain the correct dates if i try to dump them out... Also $event is injected into controller from Event model)

$starts_at = \Carbon\Carbon::createFromFormat('d/m/Y H:i', "{$this->starts_date} {$this->starts_time}");
$ends_at = \Carbon\Carbon::createFromFormat('d/m/Y H:i', "{$this->ends_date} {$this->ends_time}");

$event->fill([
        'name' => $this->name,
        'description' => $this->description,
        'starts_at' => $starts_at,
        'ends_at' => $ends_at,
])->save();
11 Jun
3 years ago

chrisgeary92 left a reply on AuthorizesResources Not Found

Seems like the problem is with your version of laravel/framework.. Running composer update should pull in the latest version (which is 5.2.31). If that doesn't work for you, then I'm not sure what else you can do. Perhaps try composer self-update before you do it.

If you run composer info laravel/framework the 4th line should show you the latest version from packagist, which is: 5.2.31.

Edit: You could try and clear your package cache: composer clearcache

chrisgeary92 left a reply on Vue Select Options Are Blank

Try this:

<option v-for="(key, status) in statuses" v-bind:value="key">
     {{ status }}
</option>

When you use v-for, it doesn't give you the key/value as an object, so in your original example s was equal to the value, not an object. You can either use the above, or modify your data to be like this:

statuses: [
    { key: 'admin', text: 'Admin' },
    { key: 'super-admin', text: 'Super Admin' }
]

chrisgeary92 left a reply on How Do I Structure Database For CBT

I would recommend you go with the suggestion from @ohffs, it's highly likely you will have to have a question with 3 or 5 answers at some point, even if it's not for a year or two.. structuring data is no easy task on a live website.

One way you can figure out how other people setup their databases, is to do some R&D on similar websites...

You could take a look at similar sites online that have question/answers and have a public API. If you take a browse through their API, you can usually get a good understanding of how they have setup their database (it's not perfect, but can be very similar).

For example, if you take a look at SurveyMonkey, you can reasonably assume they have separate tables for surveys, questions, answers, and possibly even choices for those answers. From there, you can take a look at the individual items, such as the questions, and work out what data they store.

chrisgeary92 left a reply on AuthorizesResources Not Found

If your composer.json is loading in 5.2.23 then that is probably the issue.. The AuthorizesResources trait was added in 5.2.29.

If you're running the most up to date version of laravel/laravel but loading in 5.2.23 version of laravel/framework then that would explain why your code is unable to find it within the framework.

Here is the commit: https://github.com/laravel/laravel/commit/39ba051a78c30c1829dd560c4e726a832bb8aab3

28 May
3 years ago

chrisgeary92 left a reply on Using URL With A Slash In Its Value?

You can define a regular expression for route parameters. Then you can allow slashes.

Route::get('/something/{page}')->where('page', '[A-Za-z0-9_/-]+');

chrisgeary92 left a reply on Dynamic Cron Job(Task Scheduling)

This would run every hour (as it's the longest time that fits into your 2, 5 & 10 hour slots, regardless of whether you have feeds or not. You can then use the when() method to determine if you have any feeds, and if they fit into your 2, 5 or 10 hour slots. This logic could also be added to the top of your command.

chrisgeary92 left a reply on Dynamic Cron Job(Task Scheduling)

You can make use of the when() method on the scheduler.

$scheduler->command('my:command')->hourly()->when(function () {
      // logic to determine when, returns true or false
});

https://laravel.com/docs/master/scheduling#schedule-frequency-options

14 May
3 years ago

chrisgeary92 started a new conversation Google Maps Component

Hi,

I have multiple Google maps to be loaded in to a page. I also have pages with different types of maps.

Google maps requires a ?callback=functionName parameter, but I am not quite sure how to go about doing this with Vue as I have no idea how many, or what components in my Vue scripts are present on the page. It's going to be different per-page.

I hope this makes sense, essentially i am just looking for a way to load a google map in an unknown number of different components on one or more pages.

Thanks :)

chrisgeary92 left a reply on Grabbing Request Data From Within Request Class?

public function rules()
 {
       request()->all(); // get all of the data in request
}

The request() function returns the Illuminate\Http\Request class.

or, if your CreateItemController extends the Illuminate\Http\Request class, you can simple do something like $this->id to get the ID property from your request data.

What is CreateItemController, a Controller? FormRequest? or other?

11 May
3 years ago

chrisgeary92 left a reply on Homestead Nginx 502 Recv() Failed.

Hi, Did you manage to find a solution to this. I am having the same issue with Forge.

13 Apr
3 years ago

chrisgeary92 started a new conversation Footer Newsletter (float Issue)

Jeffrey, the #newsletter-form in the footer sits on top of your Forge & Digital Ocean links :)

06 Apr
3 years ago

chrisgeary92 left a reply on Project Costs, Specifications, Etc.

It's funny you should mention the 'Pricing Design' book. I actually bought that yesterday!

Thanks for the information. I think part of our problem is how our old projects were quoted, where projects were designed & built around plugins that we knew worked, which allowed us to save a lot of time and therefore resulted in lower costs.

As we're now getting asked to quote for much larger builds, those which cannot realistically be built with this method, the costs have increased drastically as there is much more custom-code to be completed.

Once again, thanks for the information. I'll have to get started reading my new book.

chrisgeary92 started a new conversation Project Costs, Specifications, Etc.

Hi Everyone..

Does anyone know where I can find some examples of real-life project specifications for real websites? And/or example costs for those websites? I'm very new to this side of a web development business, and consequently find myself struggling to explain to management & clients why things cost what they do, and what input our team expects from a client.

Any, and all info is greatly appreciated :)

30 Mar
3 years ago

chrisgeary92 left a reply on Different User Account Types

Are you referring to the function?

You can create a helpers.php or similar in your app\ directory somewhere. It doesn't really matter where inside app\ that you put it though. Just put it somewhere that makes sense. It would depend on how you're structuring your project.

You can then autoload it from composer.json

chrisgeary92 left a reply on Different User Account Types

You will need to replace the default Auth manger class with your own. This might give you an idea how you could go about it.


UPDATE: The above was for laravel 4.2, you might be able to do it a little differently with 5. The user() method is on the SessionGuard class located here: https://github.com/laravel/framework/blob/5.2/src/Illuminate/Auth/SessionGuard.php

Perhaps you could look at extending that class, and binding your own version of it into the container


Another option would be to add a simple function or class to simplify it. Example:

function authenticatedUserIs($type) {
    return auth()->check() && auth()->user()->user_account_type == $type;
}

Usage would be:

@if(authenticatedUserIs('admin'))
    You are admin
@endif

chrisgeary92 left a reply on Homestead: 'SQLSTATE[HY000] [2002] Connection Refused (L5.2)

CLI was run inside of homestead, and the PDO connection was placed at the top of /public/index.php

I have tried various combinations of them both. Some with 127.0.0.1, some with localhost, and some with 192.168.10.10 (or whatever my homestead IP address is/was). I also changed the ports to 33060 when using the latter IP.

I'm 90% downloaded on a new homestead box now. I'm just going to go with that, as I don't have the time to spend working out how I broke homestead :D

Thanks for the help though :)

chrisgeary92 left a reply on Homestead: 'SQLSTATE[HY000] [2002] Connection Refused (L5.2)

I know all about environment files, and setting up Laravel projects. This isn't my first.. It is however, the first that has failed to run.

I was pointing out that CLI works fine, and that vanilla PHP does not, even though they're ultimately equivalent. I was wondering if someone had run into this before, and had a quick fix for it.

I am just re-downloading homestead instead, as this will be far quicker than debugging & fixing the issue.

chrisgeary92 started a new conversation Homestead: 'SQLSTATE[HY000] [2002] Connection Refused (L5.2)

I have just setup a new Laravel 5.2 project on my homestead box, and I am getting this error:

'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused' in /vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55

I have other Laravel projects (5.1) on this homestead box, and these work ok. Does anyone have any idea why this would be the case?

I have tried to connect to mysql via command line with this, which works:

mysql -uhomestead -psecret -P3306

However, when I do the same with PDO it fails

new PDO('mysql:dbname=mydatabase;host=127.0.0.1;port=3306', 'homestead', 'secret');

Thanks in advance :)

27 Dec
3 years ago

chrisgeary92 started a new conversation Syntax Error Or Access Violation: 1067 Invalid Default Value For 'created_at'

I recently setup a new php7 server with digital ocean, and forge, and envoyer.. When I came to deploy my code it fails during the migrations.

All of the migrations fail to run due to the default value for timestamps. They're set to 0000-00-00 00:00:00 which apparently MySQL doesn't like (assuming due to strict mode).

My migration looks like this:

Schema::create('checks', function (Blueprint $table) {
        $table->increments('id');
        $table->string('hash');
        $table->string('domain')->index();
        $table->string('host')->index();
        $table->timestamps();
        $table->softDeletes();
});

Error is:

SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at'

I'm running Laravel 5.1, if that makes any difference. How could I go about fixing this?

Also, it works fine within Homestead, and on my old php 5.6 server. It's just the new one which doesn't work :/

27 Nov
3 years ago

chrisgeary92 left a reply on Laravel 5.1 / Forge Cors 404/phpinfo

How is your forge setup? .. Your api.domain.io shouldn't be it's own website/install on the server. You should have 2 sites on your server for:

  • staging.domain.io
  • domain.io

Each of these could be setup to support wildcard subdomains (or just add api.) for each to the configuration on forge. Then if you access:

  • api.staging.domain.io
  • api.domain.io

These will both work, and will direct you to your laravel installation. Currently it looks like your api. domain is setup as it's own site in forge, so it's not looking at your laravel installation.

Hope that makes sense? :)

26 Sep
3 years ago

chrisgeary92 left a reply on Real Time, Web Sockets & Laravel?

For anyone that wasn't aware.. Jeffrey has started a Web Sockets series :) ..

https://laracasts.com/series/real-time-laravel-with-socket-io/episodes/1

21 Jul
4 years ago

chrisgeary92 started a new conversation DB Schema - Notification Service

I'm a little stuck with the database schema for an application I'm building and was wondering if anyone could give some advice?

Basically, I want to allow users to subscribe to certain events using a variety of services. For example..

When Event A is fired, it would send notifications via all methods that were subscribed. This might be 1 email address, 2 emails addresses, a Slack channel, a POST request to a URL, A tweet to Twitter or all of them.

An event is only ever run once. But, if this could be structured in such a way it supports an event running multiple times that would be even better.

I was thinking something like this:

| --------------------------------------------|
| Subscriptions                               |
| --------------------------------------------|
| id          | Primary Key                   |
| event_id    | ID of event subscribed to     |
| sub_id      | Object ID                     |
| sub_type    | Polymorphic Type              |
| --------------------------------------------|
| --------------------------------------------|
| Email                                       |
| --------------------------------------------|
| id          | Primary Key                   |
| address     | Email Address                 |
| --------------------------------------------|
| --------------------------------------------|
| Webhooks                                    |
| --------------------------------------------|
| id          | Primary Key                   |
| type        | Post or Get request           |
| url         | URL to trigger                |
| --------------------------------------------|
| --------------------------------------------|
| Twitter                                     |
| --------------------------------------------|
| id          | Primary key                   |
| auth_id     | Foreign ID for Auth table     |
| type        | DM or Tweet.                  |
| --------------------------------------------|
07 Jul
4 years ago

chrisgeary92 left a reply on PHP & Servers Hosts File?

Cheers for the info guys. It doesn't have to be PHP, but I'll use PHP for the client facing application so if it's possible with PHP then I'll go with that.. I'll look into it a little more, but I suspect both solutions would work, but would imagine a DNS server would be best.

chrisgeary92 started a new conversation PHP & Servers Hosts File?

I have a personal project that I'd like to start working on, but I'm a little stuck on a potential feature that I'd like to add.

Basically, I want to provide a service online that allows people to add their domain name, and IP address and preview their website before their DNS has updated. Just like what you would do if you updated the hosts file on your own machine.

Does anything know how I could go about doing this? All I can think of is that I have PHP write to /etc/hosts file, but that doesn't seem quite right.

This is the kind of thing I'd like to do: http://hosts.cx/

Thanks in advance :)

18 May
4 years ago

chrisgeary92 left a reply on Find Or New With Array Of Values.

Ah, thought there might be some fancy Laravel way to do this in a better way, rather than doing each one in a separate query. Thanks :)

chrisgeary92 started a new conversation Find Or New With Array Of Values.

Hey, I have an array of words..

$people = ['Chris', 'Dave', 'Jim', 'Bob', 'Jeffrey'];

And I have a database containing the names and associated IDs for SOME of them.

ID   |  Name
---------------------------

So, lets say for example, Chris, Dave & Bob exist in the database but Jim & Jeffrey do not exist. How would you go about writing an eloquent statement to "Find or New" for each of these words.

Some of them already exist in the database, some do not.

Thanks in advance :)

16 May
4 years ago

chrisgeary92 left a reply on Solved: Local DNS Broken On Mac?

Found the problem, these hosts records do not work while connected to a VPN. I hadn't noticed this was running.

chrisgeary92 started a new conversation Solved: Local DNS Broken On Mac?

Hi Guys,

Running... OSX 10.9.5

Just sat down to do some work on a project and when I try to visit the URL I get this error. This is a local site running on homestead. It's worked for months, but now it's broken. I've tried various other sites I have locally and they all return the same error. This is what I'm getting:

The requested URL could not be retrieved

The following error was encountered while trying to retrieve the URL: http://dev1.dunstable.co:8000/

Unable to determine IP address from host name dev1.dunstable.co

The DNS server returned:

Name Error: The domain name does not exist.
This means that the system was not able to resolve the hostname presented in the URL. Check if the address is correct.

I assume it has something to do with whatever resolves the hosts file on a mac, because even non-homestead entires are no longer working, such as the ones I have setup for MAMP. This has just stopped working overnight, as it worked ok 2 days ago and i haven't touched the computer since then.

Thanks in advance for any help, my productive day of work is likely to become a very unproductive day now :/

23 Apr
4 years ago
20 Apr
4 years ago

chrisgeary92 left a reply on Lumen & Auth

You'll have to use app('auth') or Auth:: for now.. You could probably override the Lumen Application class and change some bindings. Had a look, then gave up, so if you manage to fix it, please post below.

19 Apr
4 years ago

chrisgeary92 left a reply on Lumen & Auth

Thanks, but that doesn't really solve the problem of the Auth\Guard contract not actually working in Lumen. I was hoping for a fix that would allow that contract to work so I wouldn't have to refactor my code drastically later.

18 Apr
4 years ago

chrisgeary92 started a new conversation Lumen & Auth

Just looking at a blank install of Lumen. Literally have done nothing to it but uncommented the dot env line in /bootstrap/app.php and hooked up a route to a controller...

Just trying to inject Illuminate\Contracts\Auth\Guard and it dies with the error:

Argument 1 passed to App\Http\Controllers\Controller::test() must implement interface Illuminate\Contracts\Auth\Guard, instance of Illuminate\Auth\AuthManager given

I had a look through the code, and Laravel aliases and Lumen aliases link different classes to the "auth" binding in the container. So I kinda see why this doesn't work. Anyone else have this problem, or have an idea of a temporary fix?

@TaylorOtwell I don't know, am I missing something?

chrisgeary92 left a reply on Middleware Parameters

@dfaux you can use restful routing the other way too.. I mentioned in the above comment.

14 Apr
4 years ago

chrisgeary92 left a reply on Middleware Parameters

Thanks for the alternative method: @dfaux

Correct me if I'm wrong, but this method very similar to the one I suggested (in regards to management of permissions), only you have to manage permission in your controllers where as in my suggestion you would manage them in your routes. Also, you don't have to manage a whole bunch of routes, you can add middleware via the controller __construct() method of your controller. So it would be the same (or less) lines of code than your method. :)

I'm not sure, but if you're writing to the session on every page load, what happens if a user is trigger happy and loads multiple pages at once, do you not run the risk of your session key/value getting overwritten, and users being blocked access to pages they otherwise should have access to? Theoretically, this could happen, although not sure how likely it would be?

Update: Also, (again I don't know for sure), but writing to the session every page loads seems like a waste of server resources. It might be minimal, in which case who really cares ;) but just a thought.

chrisgeary92 started a new conversation Frontend / Admin Code Duplication & Separation. (L5)

Hi Guys,

How is everyone splitting up each entry point into their application? Particular frontend & admin panels? I'm curious to know what you do in regards to models, services that would exist within both the frontend & admin. Do you copy the models into your admin code, and just reference the same database, or do you do something else? I see benefits and drawbacks to both.

Also, a similar question regarding views/assets. I've created a method in my controller for returning views which basically prefixes all view paths with "admin" or "front" depending on which controller is being extended (FrontController or AdminController). Is anyone doing this a better way?

I've only just started working on the admin section, so if there are any tips/advice you guys have, please post below :)

I'm trying to follow a domain driven approach. Taking a lot in from the thepsion5 post about folder and namespace structure with DDD if that makes any difference :)

12 Apr
4 years ago

chrisgeary92 left a reply on What Makes A 'secure Server'

D'you mean like this? https://ssl.comodo.com/site-seal.php

I bought an SSL certificate from these guys the other day and they emailed me saying that I qualify to use this "site seal" on my site because they deem it secure (which I assume is just because I use their certificate)

chrisgeary92 left a reply on Middleware Parameters

This method works great. I've even modified the default 'auth' middleware rather than use a new 'permission' middleware (as you can only have permissions if you have an account anyway). This way it's almost identical to the L4 method :)

http://blog.elliothesp.co.uk/coding/passing-parameters-middleware-laravel-5/

08 Apr
4 years ago

chrisgeary92 left a reply on Confused About SSL Certificates + Forge

Damn it. I broke it. I don't anyone has any idea how to fix a site that 404s on http:// but works fine on https://.

server {
    listen 80;
    
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name .default;
    root /home/forge/default/current/public;

    #....

chrisgeary92 left a reply on Confused About SSL Certificates + Forge

Ah.. I didn't know I could get a free one from cloud flare.. Never mind, this was only £20 for the year.

Thanks for the info @bashy, the certificate was provided by Comodo through namecheap.com which I believe they sign. So all good :) I'll just give it a go and hope I don't break anything xD

Thanks again

chrisgeary92 started a new conversation Confused About SSL Certificates + Forge

Hi All..

I've just bought an SSL certificate for a project, and now I have no idea how to install this with Forge. What do I put for my CSR? This is for a personal project and I don't have things like "department" and I don't have "organisation" either. Should I make these up, leave them blank or pick something close?

Also do any of these fields show up in the browser to the user? For example, if I click on the padlock would I see my organisation name? Or does it depend on the certificate I purchase?

Also, I'm in the UK if that makes any difference?

Sorry, complete SSL noob here :)

chrisgeary92 left a reply on Building CMS Using Laravel !

Why do you want a CMS tutorial? To learn Laravel or because you want a CMS powered by Laravel?

If you want to learn Laravel, then it doesn't matter what videos you watch on Laracasts, all of them are absolute gold and you'll learn enough to build a CMS in under a week without watching any CMS specific tutorials :)

If you want a CMS in Laravel, and not so interested in learning Laravel you may as well just download something like Wardrobe or October.

25 Mar
4 years ago

chrisgeary92 started a new conversation Get Configuration Value In Console Schedule

Hi Guys,

I'm having trouble getting access to any configuration values within my scheduled artisan command. Whenever I try to use the following with the schedule() method:

config('app.url')

It throws:

PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class config does not exist' in /home/vagrant/Code/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:776

Is this not possible, or am I doing something wrong here?

18 Mar
4 years ago

chrisgeary92 started a new conversation WordCamp March 2015

By any chance is anyone here going to WordCamp in London at the weekend?

27 Feb
4 years ago

chrisgeary92 started a new conversation Domain Routing & Controller Arguments

Is there anyway you guys know of to create a route group containing a domain parameter without needed to specify that parameter in every controller method. For example, I have:

Route::group(['domain' => '{sub}.example.com'], function() {
       Route::get('/page', function($sub) { return 'Page'; }
       Route::get('/another', function($sub) { return 'Another'; }
});

And as you would expect, I have to specify the $sub parameter in every route which is annoying. I currently have it working without needing to specify $sub, but I'm not using the domain routing, I am using Middleware and finding the subdomain and setting that on page load. It works, but I cannot do things like linking to a particular subdomain using the route() function etc.

Hopefully this makes sense. I am not sure if there is even possible as I realise it kind of goes against the way the routing works, but hopefully someone has managed to figure something like this out?