vincej

vincej

Member Since 6 Years Ago

Calgary, Canada

Experience Points
45,650
Total
Experience

4,350 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
191
Lessons
Completed
Best Reply Awards
2
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 10
45,650 XP
Sep
18
3 days ago
Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

And Snapey wins the golden carrot!! Yes, this worked. Thank you !

route::redirect('/','/login');
Sep
17
4 days ago
Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

Ok, I did as you suggested,

Route::redirect('/',route('KidsClub.test/login'));

and got:

Route [KidsClub.test/login] not defined.
Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

Ok, so I re-entered @snapey suggestion Route::redirect('/',route('login')); and I get the error:

Route [login] not defined. 

This does not male sense to me as when I look at route:list I see:

```| GET|HEAD | login | login  | App\Http\Controllers\Auth\[email protected]  | web  | guest  |```

@jlrdw I also get a 404 when I enter a bogus url.

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

I’ll have another look at it unfortunately I’m not at home right now

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

I do have a route named login. I do not understand why it does not function.

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

Where would I be without you two guys ...

Ok ... it is fixed. Instead of having Route::redirect('/',route('login'));

I changed it to Route::view('/', 'auth/login');

Both of your questions relating to the default welcome page and 404's etc made me look carefully at my default / route which frankly had been ripped out after I installed.

Can't thank you both enough!

Cheers Vince

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

@jlrdw Sure, someone types in KidsClub.test expecting something good to happen and then just get a a nasty green banner with errors all over it. In a perfect world people would be smart and bookmark KidsClub.test/login.

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

Using version 7

I used Laravel UI & did scaffold the auth controllers.

Yes, the login route has the name login.

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

I'm not sure what you mean by the question.

It's very, very standard as far as I know. No home page, just a login page. Then a collection of pages there after which all use standard Get and Post routes.

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

I'm getting the error: Route [login] not defined.

I checked my route:list and login is defintily there pointing towards the controller & function.

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

So - should I build them a homepage with a login url and then just create a route to that homepage?

Activity icon

Replied to Redirecting When Your User Screws Up The URL Address

Homepage with a login button ... don't know what that is. So I guess I don't have one. After login, the Laravel takes the teachers straight into "Registration"

Activity icon

Started a new Conversation Redirecting When Your User Screws Up The URL Address

Hi,

The login address is KidsClub.test/login - Great.

Upon successful login, they get directed to KidsClub.test/registration - Also Great

However, suppose one of the teachers accidently just enters "KidsClub.test" without a valid url .... and you get a nastly error message as Laravel is trying to send the user off to the RouteServiceProvider, which is set to registration

OK, so - what is the best way to protect the teacher when they screw up and do not enter a valid url? Or perhaps have I not set my RouteServiceProvider correctly?

Sep
10
1 week ago
Activity icon

Replied to How To Manipulate Checkboxes With Javascript / Jquery

Yes, the user needs to press save. I have considered doing an ajax call on every checkbox, but until I am proficient using LIvewire which from the tutorials appears to have something which approaches this requriement, Ajax seems totally overkill.

Sure, my approach might not bee the right solution, and I am on the cusp of adopting an alternative if I can not get the result I need. Bottom line is I need to capture time in and time out with the opportunity to reset a time if there is human error. Any advice is very, very welcome, even if that means rewriting this module.

Activity icon

Started a new Conversation How To Manipulate Checkboxes With Javascript / Jquery

Hi!

I'm really close to solving this, but just can't get over the finish line. I have not found anything on SO or Medium which has helped.

I have a series of checkboxes in rows which log the time a person arrives and when a person leaves. Check out this image to get an understanding of what is going on:

https://drive.google.com/file/d/1-33bGrfGsnDVEYtToWbR-6Q6JndOfRRy/view?usp=sharing

Ok - so when a person arrives, the user clicks the checkbox and a Time is overlayed on that <td> Similarly when the person leaves, a later time is overlayed on that <td> and the time difference is captured. Several more people arrive and they all get their arrival time. This works fine.

The Objective: When you wish to reset a specific row, then ONLY that row is reset to the original checkbox, and the refreshed checkbox is ready to create a new time.

The Problem Described: First, when clicking "reset", ALL the checkboxes are being reset to a checkbox. This is probably because the reset function is targeting a class shared by all the rows. I realise that is wrong. Secondly, when you then check the box, I am not getting a fresh time up, but rather just a tick. New image:

https://drive.google.com/file/d/1NP_wIB5zroW7TsuLFuRzR7C7nt5OPVQ5/view?usp=sharing

There's More: So, if you should carry on clicking those boxes which were not previously reset you will still get a Time.

https://drive.google.com/file/d/1sa-6HWbnKf5XhmQb-7ndFMcA1Z2D3I6t/view?usp=sharing

My Code / What I have Done So Far: Ok, so first off, apologies to all those who hate Laravel Collective. I have added the subject's ID into the checkbox and the reset button in my view. This should allow me to isolate the specific row:

<td class="checkboxIn" >{{Form::checkbox('timeIn',$child->child_id,false)}}</td>
 <td><button type="button" class="timeInReset btn btn-light"value={{$child->child_id}}>Reset</button></td>

So, in the checkbox, I can now have JQuery grab the child_id as an attribute. This fine. However, my Reset function below, I know is completely wrong. Here is where I need your advice! Sorry for the long explanation. MANY THANKS!

Here is the JQuery:

   att = ''

    // this presents today's date on the registration form
    $("#todayDate").text(moment().format("ddd, MMM Do YYYY"));

    //This calculates the time for the checkboxes and adds it to the closest td//
    $("input:checkbox[name=timeIn]").on('click', function () {
       att =  $("input:checkbox[name=timeIn]").attr('value');
       $(this).closest("td").text(moment().format("h:mm a")).addClass("timeInserted").attr('id',att);
       console.log(att);// THIS CONFIRMS THE TIME. 
    });

    // I USE A FUNCTION, SO I CAN REPEAT THE EVENT WITH EVERY CLICK
    $(".timeInReset").click(function(){   
        reset(att);  
    })

    function reset(){
     $(".timeInserted").html("<input type=checkbox name=test1 value=att >"); // THIS IS WRONG !! 
       }


Sep
01
2 weeks ago
Activity icon

Replied to L7 Ignores Submit

I believe so. The Class is this:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Children;

class Child extends Controller
{

 public function upDateChild(Request $request)
    {
        dd($request);
        $children = Children::all();
        redirect()->route('editChild',compact('children'));
    }


}
Activity icon

Started a new Conversation L7 Ignores Submit

This is a mystery to me. I have written hundreds of Form::Open and Form::Close lines. Yet for some bizaar reason this time the Form::submit is entirely ignored by L7. And even more curious I have another view in my app where it works fine. Collective is installed. So I must have become word blind to the fault. Note - I am not getting any errors. Clicking the submit button gives me nothing. I can even take the action=>route out and it doesn't care. I get nothing. I have tried everything includung using HTML standard mark up, view:clear, config:clear, It is totally disfunctional. Ok - here is the meat:

The Important part of the View

  {{Form::open(['action'=>'[email protected]'])}}

   @foreach($children as $child)
    <tr>
        <td>{{$child->childOneFirstName}}</td>
        <td>{{$child->childOneLastName}} </td>
         <td>
            <div class="custom-control custom-switch">
                <input type="checkbox" class="custom-control-input" id="{{$child->child_id}}" value="checked">
                <label class="custom-control-label" for="{{$child->child_id}}" >Inactive / Active</label>
            </div>
        </td>
    </tr>
    @endforeach
   </tbody>
</table>

    {{ Form::submit('Update', ['class'=>'btn  btn-primary']) }}

    {{Form::close()}}

The Route

Route::post('/upDateChild', '[email protected]')->name('upDateChild');

The Controller

public function upDateChild(Request $request)
    {
        dd($request);
        $children = Children::all();
        redirect()->route('editChild',compact('children'));
    }

Any advice is welcome! Thanks !

Aug
23
4 weeks ago
Activity icon

Started a new Conversation How To Install Xdebug In Homestead

I have found a few tutorials, however they are all years old and no longer work. The last one I watched was from Tighten.

Anyone have a current tutorial on how to do it??

Thanks !

Jul
28
1 month ago
Activity icon

Replied to Need JS Advice: How To DYNAMICALLY Present Catgories In A View

@jbloomstrom Many thanks for your replay. Dumb question: I have reams of Javascript and Jquery in my app already. Is there any potential problem in adding vuejs to my app as well? eg conflicts or performance?

Thanks !

Activity icon

Started a new Conversation Need JS Advice: How To DYNAMICALLY Present Catgories In A View

I use a nested set mode. All my categories work fine and present fine on the page. What I want is to be able to manipulate them dynmically on the page in the same way as windows 10 or IOS can. That is the say, drag and drop it and it's children under a new parent. Right click and add a category, or delete a category. And then upload back to the controller.

I have considered doing the manipulation and then serialising the form, and running a foreach on every single catgeory. To me this is very messy and probably very very slow, as a organsiation might have a gazzilion categories.

Yes, I have tried using JSTree and JQTree. Their documentation is appaling, and they just do not work. I have also considered using JQueryUI for the drag and drop

This must be one of the most common exercises in web development, yet it appears to be not well served. So any advice?

Many thanks !

Jul
07
2 months ago
Activity icon

Replied to How To Clear Cache After Logout

@snapey Many Thanks! It's working as required!

@nakov I checked my middleware, and fixed a few which were not set correctly. Yes, I have multiple guards for admins and contractors, and so I do user auth:admin and auth:contractor

I have been rebuilding my authentication system for two different user types, "Admin" and "Contractor". After making these adjustments things are working as I want it. However, I am very concerned that I do not why it works. I have checked SO, watched Jeffrey's tutorial on Authentication and read some pieces in Matt Stauffer's book. None of these resouces give a clear and articulate description of how all the pieces work together.

How does a level 50 person get to where they are withou clear resources? Do you spend sleepless nights studying the API?? For me, the API is in itself an incomprehensable document. All advice is welcome! :o)

Many thanks !

Jul
03
2 months ago
Activity icon

Started a new Conversation How To Clear Cache After Logout

I tried using this code. However, it does not work. Even after a logout I can use the back button to see the previous pages prior to logout and I can even still interact with the server. However, my session data ie Name and ID, has been cleared. What am I doing wrong?

Many thanks !

public function logout(Request $request)
    {       Auth::guard('web')->logout();
            header("cache-Control:no-store,no-cache, must-revalidate");
            header("cache-Control:post-check=0,pre-check=0",false);
            header("Pragma:no-cache");
            header("Expires: Sat,26 Jul 1997 05:00:00: GMT");
            $request->session()->flush();
            $request->session()->regenerate();
            return redirect()->route('loggedOut');
    }

Jun
16
3 months ago
Activity icon

Replied to Place Holder Text Does Not Show In Text Area

Unbelievable! Thank you very much !!

Activity icon

Started a new Conversation Place Holder Text Does Not Show In Text Area

This is bizaar. I use placeholder text in forms to helpthe user how & what to input. Placeholders work fine one simple input fields, however, on a textarea the placeholder text just does not want to show up. Well, not at least untill you have entered something. Then and only then, f you delete the text you have entered does the placehold text show up.

I have tried with Collective as well as with raw HTML. Both gives the same result.

Any ideas?

<div class="form-row form-group">
                    <div class="col-sm-12 col-md-12"><textarea class="form-control" id="quote_comment" placeholder="free format comment" rows="3" name="comment" cols="50"> </textarea></div>
                     </div>
Jun
07
3 months ago
Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

IT WORKED!!! SOLVED!!! MANY THANKS !!!

Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

mysql> SELECT @@sql_mode; +------------------------------------------------------------------------------------------------------------------------+ | @@sql_mode | +------------------------------------------------------------------------------------------------------------------------+ | STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)

Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

@guybrush_threepwood Ok, did as you suggested. As works as before. Still with the MySQL error. Is this supposed to help with setting the only_fully_group_by problem?

Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

@guybrush_threepwood Ok, however, I am using Homestead for this deployment. I'm not too sure what url I should use for HOmestead.

Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

@jlrdw Thanks for that. What is curious to me is that my Linux dev machine has the same MySQL version, although it is rinning L6.x.

The article I quoted above required a whole sale massive rewrite, This is very undesirable. Moderate rewrite is not a problem.

Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

@jlrdw Like I said, I have alerady changed the connection to false.

@guybrush_threepwood I'm using L7.11.0

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    'default' => env('DB_CONNECTION', 'mysql'),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('127.0.0.1'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '33060'),
            'database' => env('DB_DATABASE', ''),
            'username' => env('DB_USERNAME', ''),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => false,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

        'pgsql' => [
            'driver' => 'pgsql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
            'schema' => 'public',
            'sslmode' => 'prefer',
        ],

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    */

    'migrations' => 'migrations',

    /*
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer body of commands than a typical key-value system
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    */

    'redis' => [

        'client' => env('REDIS_CLIENT', 'phpredis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'redis'),
            'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', '0'),
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_CACHE_DB', '1'),
        ],

    ],

];


Activity icon

Replied to How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

@jlrdw Brilliant! It works! But here is the bigger question, how can I set this globally? Adding this statement to all my queries is not too bad, however, it seems a little unneccessary.

I have already set config.database.mysql.strict = false to no effect.

Additionally I tried some advice on SO, to set mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); also to no effect.

Activity icon

Started a new Conversation How To Solve The MySQL 5.7.30 "sql_mode=only_full_group_by" Problem

I did a fresh install of Homestead which includes MySQL 5.7.30. I brought across all my Laravel files from my Linux system which also runs MySQL 5.7.30.

For some reason bizaar reason when I run queries on the Homestead system I get the problem:

Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'contraxiq.orders.quote_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Ok - so inside the Homestead version I set the config/database mysql strictsettings to "false". I have also tried turning off the error with no effect.

mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

I have dozens of queries with groupby. As an example, here is one which generates the error:

 public function open_orders() {
        return DB::table('orders')
            ->join('customers', 'customers.id', '=', 'orders.customer_id')
            ->select('orders.reference', 'quote_name','start_date', 'company_name', 'customers.firstname1', 'customers.lastname1', 'customers.city', 'orders.total', 'orders.created_at')
            ->where('orders.status', '=', 'open')
            ->groupBy('orders.reference')
            ->orderBy('orders.created_at')
            ->get();
    }


Wat do I do to fox this problem ? I do not want to rewrite all the dozens of queries as suggested by this post: https://gabi.dev/2016/03/03/group-by-are-you-sure-you-know-it/

Many Thanks !!

May
20
4 months ago
Activity icon

Started a new Conversation Multi-Auth Is Not Working With, "protected $redirectTo = RouteServiceProvider::HOME;"

When I click "log out" it goes to the $redirectTo, and entirely ignores my log out code.

For some reason, I can log into my two different user dashboards, but when I want to log out, this stupid constant keeps wanting to take me to "Home" which by default is "login". All I want to do is log out my user! Nothing else. Commenting the Const does not help, you just get an error.

What am I am I doing wrong?

This is my controller code:


    public function userlogout(Request $request)
    {
            Auth::guard('web')->logout();
            $request->session()->flush();
            $request->session()->regenerate();
            return redirect()->route('logged_out');
    }

May
12
4 months ago
Activity icon

Replied to Upgraded To L7 Now Getting Error: "InvalidArgumentException Auth Guard [admin] Is Not Defined."

Given that the multi auth system I borrowed from John Curtis / DevMarketer stems from L5, and now we have a L7 / UI, I have made the decision to make use of the UI system. So I am reinstalling Homestead with a fresh copy of L7. I will add the UI and then build things back up from there. I have found a new tut for multi-auth aimed at L7 and so I'll try that.

I'm sure I'll update this Q. tomorrow perhaps when it all goes to rat shit. :o)

Many thanks for all your contributions.

Activity icon

Replied to Upgraded To L7 Now Getting Error: "InvalidArgumentException Auth Guard [admin] Is Not Defined."

The back ground is, that back with L5 I built a multi-authentication system allowing users and admins using a tutorial from "devMarketer" aka John Curtis. Laravel could not support multiple users, and still can't (??) Can laravel / ui support multiple user types??

Activity icon

Started a new Conversation Upgraded To L7 Now Getting Error: "InvalidArgumentException Auth Guard [admin] Is Not Defined."

Everthing works on L6 Linux server. Now I have moved my app over to Windows 10, Homestead with L7 using a copy and paste. I get my login screen, however, when I try to login I am getting:

InvalidArgumentException
Auth guard [admin] is not defined.

I have checked and my Handler file has the guard there as too the RedirectifAuthenticated middleware also the auth.php.

I have not used the laravel/ui

Any ideas where I should start looking or why this is failing under L7?

May
11
4 months ago
Activity icon

Replied to Homestead: Imported Site Will Not Display

Well, I managed to get a nice login screen! Yeah! So something is working now. However, I now get a new error on my first page inside my app:

InvalidArgumentException
Auth guard [admin] is not defined.

Every single controller uses Auth guard [admin]. So I guess all that is gone. Back in L5 days I built a dual athentication system for admins and for users. Do I need to rebuild all that ?

Activity icon

Replied to Homestead: Imported Site Will Not Display

Ok - I found the advice re the authentication scafolding.

Activity icon

Replied to Homestead: Imported Site Will Not Display

Brilliant Thanks guys, it looks like I am now reaching my app however, I have a new problem which appears not to be on the upgrade guide. My login form uses the trait use AuthenticatesUsers; I am getting a not found error. So when I hunt down use Illuminate\Foundation\Auth\AuthenticatesUsers;. Sure enough it is not there anymore. So, where has it gone? Any ideas?? Many Thanks !!

Error:

Symfony\Component\ErrorHandler\Error\FatalError
Trait 'Illuminate\Foundation\Auth\AuthenticatesUsers' not found

Activity icon

Replied to Homestead: Imported Site Will Not Display

I'm not really sure what to do with this. I have had a look at the L7 upgrade guide on the topic of Symphony 5 Related Upgrades. What am I supposed to do with these code changes?? My current except file looks like this:

<?php

namespace App\Exceptions;


use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        \Illuminate\Auth\AuthenticationException::class,
        \Illuminate\Auth\Access\AuthorizationException::class,
        \Symfony\Component\HttpKernel\Exception\HttpException::class,
        \Illuminate\Database\Eloquent\ModelNotFoundException::class,
        \Illuminate\Session\TokenMismatchException::class,
        \Illuminate\Validation\ValidationException::class,
    ];

       
    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Exception $exception)
    {
        parent::report($exception);
    }


    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        return parent::render($request, $exception);
    }

    /**
     * Convert an authentication exception into an unauthenticated response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Auth\AuthenticationException  $exception
     * @return \Illuminate\Http\Response
     */
    protected function unauthenticated($request, AuthenticationException $exception)
    {
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }

        $guard = array_get($exception->guards(), 0);

        switch ($guard) {
                case 'admin':
                $login =  'admin.login';
                break;


            default:
                $login = 'portalLoginForm';
                break;
        }

        return redirect()->guest(route($login));
    }
}


Activity icon

Replied to Homestead: Imported Site Will Not Display

Ok - looks like the problem has something to do with upgrading from L6 to L7.

https://github.com/laravel/framework/issues/31686

Activity icon

Replied to Homestead: Imported Site Will Not Display

Ok - I found where artisan is, and cd'ed into the laravel project called test where aritsan is. I got a big error when calling php artisan . Hopefully this might help diagnose the problem - Many thanks !!

[email protected]:~/code/test$ php artisan
PHP Fatal error:  Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in /home/vagrant/code/test/app/Exceptions/Handler.php on line 33
PHP Fatal error:  Uncaught ReflectionException: Class App\Exceptions\Handler does not exist in /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
Stack trace:
#0 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(805): ReflectionClass->__construct()
#1 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\Container\Container->build()
#2 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve()
#3 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(265): Illuminate\Foundation\Application->resolve()
#4 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(801): Illuminate\Container\Container->Illuminate\Container\{closure}()
#5 /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\Container\Container->bu in /home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 807



Activity icon

Replied to Homestead: Imported Site Will Not Display

oops - that's "cache" not car wash. Voice to text get's confused!

Activity icon

Replied to Homestead: Imported Site Will Not Display

Yes I set up a project it is called my app..test. I'm not sure how I could clear my route cache if I can't get into PHP artisan. I copied files over rather than organically creating them.

Activity icon

Replied to Homestead: Imported Site Will Not Display

Thanks for that can you please tell me where the art is an file is supposed to be ?

Activity icon

Started a new Conversation Homestead: Imported Site Will Not Display

I have loaded homestead and Laravel 7 onto Windows 10. The Laravel Homepage displays nicely. OK, so I have then copied and pasted my establsihed and working code ( App, Resources, Public, Routes) from my LInux server, into my Win10 users\vince\code folder which should update the Homestead server. Sure enough it is in the Code folder in Homestead. Great.

Excepting for the Laravel Welcome page, nothing from my application displays in the browser when I use the url for the Homestead site. All I get is an error This page isn't working, mysite.test is currently inavailable to handel this request, error 500.

Ok, so I provisioned the site again. I have halted Vagrant and restarted. Neither helped. However, still, the Laravel Welcome page shows and I can change it.

I tried to use php artisan to try to clear the cache on the Homestead site, however, I get:

[email protected]:~$ php artisan
Could not open input file: artisan

I did see a post on Laracasts saying some guy added Way/generators and claims that fixed his problem, but that makes zero sense to me as that package just generates modesl and controllers.

So any / all advise is welcome.

Many Thanks !

Apr
26
4 months ago
Activity icon

Awarded Best Reply on Vagrant Does Not Boot Into Homestead

SOLVED! Ok, as often is the case, I made a dumb mistake.

Because I have previously been implimenting PHP environments on my Windows 10 laptop, I had designated in my Hosts file 127.0.0.1 localhost. So, when I entered the IP for my Homestead app as 192.168.10.10 Vagrant was grabing the local host IP rather than the Vagrant app IP. So it did not boot into Homestead but rather into Vagrant itself.

So - for the benefit of anyone else wanting to install Homestead on Windows 10, I have found that there is only 1 explanation out there, which is succinct and clear. Trust me, I tried them all! Credit to this guy on youtube:

Peter Steel ( https://www.youtube.com/watch?v=Il08--droNI )

Activity icon

Replied to Vagrant Does Not Boot Into Homestead

SOLVED! Ok, as often is the case, I made a dumb mistake.

Because I have previously been implimenting PHP environments on my Windows 10 laptop, I had designated in my Hosts file 127.0.0.1 localhost. So, when I entered the IP for my Homestead app as 192.168.10.10 Vagrant was grabing the local host IP rather than the Vagrant app IP. So it did not boot into Homestead but rather into Vagrant itself.

So - for the benefit of anyone else wanting to install Homestead on Windows 10, I have found that there is only 1 explanation out there, which is succinct and clear. Trust me, I tried them all! Credit to this guy on youtube:

Peter Steel ( https://www.youtube.com/watch?v=Il08--droNI )

Apr
25
4 months ago
Activity icon

Started a new Conversation Vagrant Does Not Boot Into Homestead

I'm new to Homestead. I'm deploying Homestead on Windows 10.

Everything appears to be installed correctly. When I do a "Vagrant up" I get the nice "HOMESTEAD" banner showing in Git Bash. however, the command line shows [email protected] rather than [email protected]. Furthermore, if I do an ls there is no Code folder.

I have tried deleting the Vagrantfile and doing a fresh init. Also I did vagrant provision -- force. I even have removed Vagrant and reinstalled it.

What have I done wrong, and how do I fix it?

Many thanks

Apr
18
5 months ago
Activity icon

Replied to How To Best Format Data For Use In JqTree

I forced myself into reading about Eleoquent relationships. Relationships require the use of 2 or more tables. My categories are held on a single table. columns are: category_id (prime), parent_id, name, rgt, lft, depth.

I imagine that is why relationships won't work for me. Ugh. Thanks