JanakaDombawela

JanakaDombawela

Senior Software Engineer at Ontomatrix Digital Marketing

Member Since 2 Years Ago

Matale

Experience Points
1,390
Total
Experience

3,610 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
0
Lessons
Completed
Best Reply Awards
1
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 1
1,390 XP
Apr
08
6 months ago
Activity icon

Started a new conversation Laravel File Store Returns Tmp File Name.

Hi, simple question. I tried to save a file to storage from a form post. Code:

$path = $request->file('image')->store('image');

But the $path returns as /tmp/phpCCTWsV

How to fix this?

Mar
11
7 months ago
Activity icon

Replied to Route Model Binding With Soft Deleted Model

If anyone looking for a more neat solution:

Add


Route::bind('project', function ($value) {
    if (Route::currentRouteName() === 'project.show') {
        return \App\Project::withTrashed()->find($value);
    }
    return \App\Project::find($value);
});

in \App\Providers\RouteServiceProvider boot function

https://stackoverflow.com/a/52535591/3383167

Mar
10
7 months ago
Activity icon

Replied to Get Auth:user() Without Adding The Middleware('auth')

@snapey Thank you. I made a mistake. It should be middleware('auth:api'). But I thought sending the bearer token would register a user authenticated even there is no middleware. Guess I have to look into another method. Thanks again.

Activity icon

Started a new conversation Get Auth:user() Without Adding The Middleware('auth')

Hi, I have following scenario. I have to check if user is logged in and if logged in I have to get the user details in a non authenticated URL endpoint. But I always get Auth::check() false and Auth::user() null unless I add the middleware('auth').

Surprisingly lot of people has that same issue. (https://stackoverflow.com/questions/53790721/laravel-5-7-how-to-use-authcheck-even-when-not-using-auth-middleware / https://stackoverflow.com/questions/46807121/laravel-how-to-find-if-a-user-is-logged-in-without-forcing-a-redirect)

Can anyone help me with this?

Feb
24
7 months ago
Activity icon

Replied to Laravel Default Login Redirection Not Working

@MUNAZZIL -


<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @param  string|null $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return redirect()->intended();
        }

        return $next($request);
    }
}


Feb
22
7 months ago
Activity icon

Replied to Laravel Default Login Redirection Not Working

@SNAPEY - Tried it. Still no luck. :(

Activity icon

Replied to Laravel Default Login Redirection Not Working

@SNAPEY - That's what I thought too, it should work out of the box. Sessions are working fine. I can go to the authenticated urls without login again. And I did not change anything in auth controllers.

Feb
21
7 months ago
Activity icon

Started a new conversation Laravel Default Login Redirection Not Working

Hi I have installed the Laravel 5.7 version and when I go to authenticated url it redirects to the login page, but after login it redirects to home page.

This authenticated url could be any url that is authenticated with laravel auth middleware.

Here is my example router resource code for the url:

Route::namespace('User')->group(function () {
    Route::middleware('auth')->resource('delivery', 'DeliveryController');
});

The default behavior is when we try to go to a authenticated url it should redirect to login and after login it should redirect back to the authenticated url.

Ex:

delivery->login->delivery

customer->login->customer

But the problem is whatever url I call it redirects to home page (which is the $redirectedTo in LoginController) after login. I have installed the passport for API authentication. Can anyone suggest me where should I start looking?

Dec
31
9 months ago
Activity icon

Started a new conversation When Parsing A 12 Hour Time Carbon Changes The Time

Hi, I trie to parse a 12 hour time as follows:

Carbon::parse("11:05 AM")->toDateTimeString();

I get the output like follows: 2018-12-31 00:00:00

Then I tried to parse the time with a date, but same results. Anyone know why this happening?

Dec
28
9 months ago
Activity icon

Replied to Laravel Strange Routes Behavior

Routes in route.php:

<?php

Route::get('/', 'Auth\[email protected]');
Route::get('auth/login', 'Auth\[email protected]');
Route::post('auth/login', 'Auth\[email protected]');
Route::get('auth/logout', 'Auth\[email protected]');

Route::post('/media/{bucket}/upload', '[email protected]');
Route::get('/media/{bucket}/{folder}/{id}', '[email protected]');
Route::post('/media/upload/tender-attachment', '[email protected]');

#AJAX Request
Route::get('ajax/places/location', '[email protected]');
Route::get('ajax/truck/route', '[email protected]');

Route::group(['prefix' => 'dash', 'middleware' => 'auth'], function()
{
    Route::get('/', '[email protected]');

    Route::get('/search/vehicle', '[email protected]');
    Route::get('/search/passenger', '[email protected]');
    Route::get('/search/user', '[email protected]');
    Route::get('/search/driver', '[email protected]');

    Route::get('/feed/passenger_canceled', '[email protected]');
    Route::get('/feed/driver_rejected', '[email protected]');
    Route::get('/feed/drivers_online', '[email protected]');

    Route::get('/map', '[email protected]');
    Route::get('/map/daily_drivers', '[email protected]');
    Route::get('/map/jobs', '[email protected]');
    Route::get('/map/sos-drivers', '[email protected]tSosDrivers');
    Route::get('/map/driver/{id}', '[email protected]');
    Route::get('/map/job/{id}', '[email protected]');

    Route::get('/driver/list/{view?}', '[email protected]');
    Route::get('/driver/new', '[email protected]');
    Route::post('/driver/new', '[email protected]');
    Route::get('/driver/{did}/edit', '[email protected]');
    Route::post('/driver/{did}/edit', '[email protected]');

    Route::get('/driver/{did}/view', '[email protected]');
    Route::get('/driver/{did}/change_password', '[email protected]');
    Route::post('/driver/{did}/change_password', '[email protected]');
    Route::get('/driver/{did}/job', '[email protected]');
    Route::get('/driver/{did}/stat', '[email protected]');

    Route::get('/driver/{did}/vehicle/new', '[email protected]');
    Route::post('/driver/{did}/vehicle/new', '[email protected]');
    Route::get('/driver/{did}/vehicle/{vid}/edit', '[email protected]');
    Route::post('/driver/{did}/vehicle/{vid}/edit', '[email protected]');
    Route::get('/driver/{did}/vehicle/{vid}/partial', '[email protected]');
    Route::get('/driver/{vno}/get', '[email protected]');

    Route::get('/vehicle/new', '[email protected]');
    Route::post('/vehicle/new', '[email protected]');
    Route::get('/vehicle/list', '[email protected]');
    Route::get('/vehicle/{vid}/edit', '[email protected]');
    Route::post('/vehicle/{vid}/edit', '[email protected]');
    Route::get('/vehicle/{did}/view', '[email protected]');

    Route::get('/passenger/list', '[email protected]');
    Route::get('/passenger/{pid}/edit', '[email protected]');
    Route::post('/passenger/{pid}/edit', '[email protected]');
    Route::get('/passenger/{id}/view', '[email protected]');
    Route::get('/passenger/{id}/job', '[email protected]');

    Route::get('/rate_card/hire', '[email protected]');
    Route::get('/rate_card/hire/new', '[email protected]');
    Route::post('/rate_card/hire/new', '[email protected]');
    Route::get('/rate_card/hire/{rid}/edit', '[email protected]');
    Route::post('/rate_card/hire/{rid}/edit', '[email protected]');

    Route::get('/rate_card/courier', '[email protected]');
    Route::get('/rate_card/courier/new', '[email protected]');
    Route::post('/rate_card/courier/new', '[email protected]');
    Route::get('/rate_card/courier/{cid}/edit', '[email protected]');
    Route::post('/rate_card/courier/{cid}/edit', '[email protected]');
    Route::get('/rate_card/courier/{cid}/delete', '[email protected]');

    Route::get('/rate_card/shop', '[email protected]');
    Route::get('/rate_card/shop/new', '[email protected]');
    Route::post('/rate_card/shop/new', '[email protected]');
    Route::get('/rate_card/shop/{rid}/edit', '[email protected]');
    Route::post('/rate_card/shop/{rid}/edit', '[email protected]');

    Route::get('/rate_card/truck/new', '[email protected]');
    Route::post('/rate_card/truck/new', '[email protected]');
    Route::get('/rate_card/truck/{crid}/edit', '[email protected]');
    Route::post('/rate_card/truck/{crid}/edit', '[email protected]');
    Route::get('/rate_card/truck-place/{rateCardId}/edit','[email protected]_Place');
    Route::post('/rate_card/truck-place/new','[email protected]_Place');
    Route::post('/rate_card/truck-place/{rateCardId}/edit','[email protected]_Place');
    Route::get('/rate_card/truck-place/{rateCardId}','[email protected]_Places');
    Route::get('/rate_card/truck', '[email protected]');

    Route::get('/rate_card/islandwide', '[email protected]');

    Route::get('/rate_card/vehicle_service', '[email protected]');

    Route::get('/job_number/{jn}', '[email protected]');

    Route::get('/job/regular/list/{view?}', '[email protected]');
    Route::get('/job/islandwide/list/{view?}', '[email protected]');
    Route::get('/job_queue', '[email protected]');
    Route::get('/job/cargo/job_queue', '[email protected]');
    Route::get('/job/cargo/{jid}', '[email protected]');

    Route::get('/backhaul/new', '[email protected]');
    Route::post('/backhaul/new', '[email protected]');
    Route::get('/job/cargo/{jid}/backhaul/new', '[email protected]');
    Route::post('/job/cargo/{jid}/backhaul/new', '[email protected]');
    Route::get('/job/cargo/{jid}/assign_driver/{dt}', '[email protected]');
    Route::get('/job/cargo/regular/list/{view?}', '[email protected]');
    Route::get('/job/cargo/tender/list/{view?}', '[email protected]');
    Route::get('/job/cargo/backhaul/list' , '[email protected]');
    Route::get('/job/freight-forwarding/list/', '[email protected]');

    Route::get('/job/new', '[email protected]');
    Route::post('/job/new', '[email protected]');
    Route::get('/job/{jid}', '[email protected]');

    Route::get('/job/cargo/tender/{jid}', '[email protected]');
    Route::get('/job/cargo/tender/{id}/place-bid', '[email protected]');
    Route::post('/job/cargo/tender/{id}/place-bid', '[email protected]');

    Route::get('/job/freight-forwarding/{jid}', '[email protected]')->name('FreightJobShow');
    Route::get('/job/freight-forwarding/{jid}/place-bid', '[email protected]');
    Route::post('/job/freight-forwarding/{jid}/place-bid', '[email protected]');

    Route::get('/job/freight-forwarding/{jid}/bid/{bid}/edit-bid', '[email protected]');
    Route::post('/job/freight-forwarding/{jid}/bid/{bid}/edit-bid', '[email protected]');

    Route::get('/job/freight-forwarding/{jid}/bid/{bid}/get-messages', '[email protected]');
    Route::post('/job/freight-forwarding/{jid}/bid/{bid}/send-message', '[email protected]');

    Route::get('/job/freight-forwarding/{jid}/bid/{bid}/confirm-bid', '[email protected]');

    Route::get('/job/cargo/tender/bid/{id}/edit-bid', '[email protected]');
    Route::post('/job/cargo/tender/bid/{id}/edit-bid', '[email protected]');

    Route::get('/job/cargo/tender/{jid}/bid/{bid}/confirm-bid', '[email protected]');

    Route::get('/job/{jid}/edit', '[email protected]');
    Route::post('/job/{jid}/edit', '[email protected]');

    Route::get('/job/{jid}/mark_test_job_status', '[email protected]');
    Route::post('/job/{jid}/passenger-call', '[email protected]');

    Route::get('/job/{jid}/dropoff_status/{did}', '[email protected]');
    Route::post('/job/{jid}/dropoff_status/{did}', '[email protected]');

    Route::get('/job/cargo/{jid}/dropoff_status/{did}', '[email protected]');
    Route::post('/job/cargo/{jid}/dropoff_status/{did}', '[email protected]');

    Route::get('/job/{jid}/dropoff_cod/{did}', '[email protected]');
    Route::post('/job/{jid}/dropoff_cod/{did}', '[email protected]');
    Route::get('/job/{jid}/job_status', '[email protected]');
    Route::post('/job/{jid}/job_status', 'JobController[email protected]');
    Route::get('/job/{jid}/pickup_id', '[email protected]');
    Route::post('/job/{jid}/pickup_id', '[email protected]');
    Route::get('/job/{jid}/assign_driver', '[email protected]');
    Route::post('/job/{jid}/assign_driver', '[email protected]');
    Route::get('/job/{jid}/change_company', '[email protected]');
    Route::post('/job/{jid}/change_company', '[email protected]');
    Route::get('/job/{jid}/new_dropoff', '[email protected]');
    Route::post('/job/{jid}/new_dropoff', '[email protected]');

    Route::get('/job/{jid}/waybill', '[email protected]');

    Route::get('/job/{jid}/eta', '[email protected]');
    Route::post('/job/{jid}/eta', '[email protected]');

    Route::get('/job/{jid}/re-queue', '[email protected]');

    Route::get('/job/{jid}/invoice/{iid}', '[email protected]');

    Route::get('/job/{jid}/summary/edit', '[email protected]');
    Route::post('/job/{jid}/summary/edit', '[email protected]');
    Route::get('/job/{jid}/fare/edit', '[email protected]');
    Route::post('/job/{jid}/fare/edit', '[email protected]');

    Route::get('/bookings/warehouse/list/{view?}', '[email protected]');

    Route::get('/bookings/warehouse/retreive_requests', '[email protected]');
    Route::get('/bookings/warehouse/{id}/view', '[email protected]');
    Route::get('/bookings/warehouse/{id}/booking_status', '[email protected]');
    Route::post('/bookings/warehouse/{id}/booking_status', '[email protected]');

    Route::get('/comment/list', '[email protected]');
    Route::get('/comment/{cid}/followup', '[email protected]');
    Route::post('/comment/{cid}/followup', '[email protected]');

    Route::get('/affiliate/list', '[email protected]');
    Route::get('/affiliate/new', '[email protected]');
    Route::post('/affiliate/new', '[email protected]');

    Route::get('/affiliate/{aid}/view', '[email protected]');
    Route::get('/affiliate/{aid}/edit', '[email protected]');
    Route::post('/affiliate/{aid}/edit', '[email protected]');
    Route::get('/affiliate/{aid}/rate_card', '[email protected]');
    Route::get('/affiliate/{aid}/manage_user', '[email protected]');
    Route::post('/affiliate/{aid}/manage_user', '[email protected]');
    Route::post('/affiliate/{aid}/manage_user/remove', '[email protected]');

    Route::get('/affliate/{id}/vehicles/{type}', '[email protected]');

    Route::get('/warehouse/list', '[email protected]');
    Route::get('/warehouse/new', '[email protected]');
    Route::post('/warehouse/new', '[email protected]');
    Route::get('/warehouse/{wid}/edit', '[email protected]');
    Route::post('/warehouse/{wid}/edit', '[email protected]');

    Route::get('/company/list', '[email protected]');
    Route::get('/company/new', '[email protected]');
    Route::post('/company/new', '[email protected]');
    Route::get('/company/{cid}/view', '[email protected]');
    Route::get('/company/{cid}/edit', '[email protected]');
    Route::post('/company/{cid}/edit', '[email protected]');
    Route::get('/company/{cid}/rate_card', '[email protected]');
    Route::post('/company/{cid}/status/{status}', '[email protected]');
    Route::get('/company/{cid}/view_details', '[email protected]');

    Route::get('/company/{cid}/manage_user', '[email protected]');
    Route::post('/company/{cid}/manage_user', '[email protected]geUsers');
    Route::get('/company/{cid}/manage_user/{uid}/activate', '[email protected]');
    Route::get('/company/{cid}/manage_user/{uid}/deactivate', '[email protected]');
    Route::get('/company/{cid}/manage_user/{uid}/change_department/{did}', '[email protected]');
    Route::get('/company/{cid}/manage_user/{uid}/change_role/{rid}', '[email protected]');

    Route::get('/company/{cid}/manage_department', '[email protected]');
    Route::get('/company/{cid}/manage_department/new', '[email protected]');
    Route::post('/company/{cid}/manage_department/new', '[email protected]');
    Route::get('/company/{cid}/manage_department/{did}', '[email protected]');
    Route::post('/company/{cid}/manage_department/{did}', '[email protected]');

    Route::get('/company/call-log', '[email protected]');
    Route::post('/company/call-log', '[email protected]');
    Route::get('/company/{cid}/manage_service', '[email protected]');
    Route::post('/company/{cid}/manage_service', '[email protected]');

    Route::get('/user/list', '[email protected]');
    Route::get('/user/new', '[email protected]');
    Route::post('/user/new', '[email protected]');
    Route::get('/user/{id}/edit', '[email protected]');
    Route::post('/user/{id}/edit', '[email protected]');

    Route::get('/role/list', '[email protected]');
    Route::get('/role/new', '[email protected]');
    Route::post('/role/new', '[email protected]');
    Route::get('/role/{id}/edit', '[email protected]');
    Route::post('/role/{id}/edit', '[email protected]');

    Route::get('/permissions/list', '[email protected]');
    Route::get('/permissions/new', '[email protected]');
    Route::post('/permissions/new', '[email protected]');
    Route::get('/permissions/{id}/edit', '[email protected]');
    Route::post('/permissions/{id}/edit', '[email protected]');

    Route::get('/report', '[email protected]');
    Route::get('/report/company_monthly_transactions', '[email protected]');
    Route::get('/report/company_monthly_cod_transactions', '[email protected]');
    Route::get('/report/non_corporate_transactions', '[email protected]');
    Route::get('/report/company_cod', '[email protected]');
    Route::get('/report/company_monthly_revenue', '[email protected]');
    Route::get('/report/company_payments', '[email protected]');
    Route::get('/report/company_users', '[email protected]');
    Route::get('/report/driver_daily_transactions', '[email protected]');
    Route::get('/report/driver_daily_cod', '[email protected]');
    Route::get('/report/driver_cash_deposit', '[email protected]');
    Route::get('/report/affiliate_monthly_transactions', '[email protected]');
    Route::get('/report/affiliate_daily_driver_stats', '[email protected]');
    Route::get('/report/undelivered_dropoffs', '[email protected]');

    Route::get('/settings', '[email protected]');
    Route::post('/settings', '[email protected]');

    Route::get('/vendor/list', '[email protected]');
    Route::get('/vendor/{vid}/view', '[email protected]');
    Route::get('/vendor/{vid}/update_index', '[email protected]');

    Route::get('/finance/cod_all', '[email protected]');

    Route::get('/finance/cash_deposits', '[email protected]');
    Route::get('/finance/cash_deposits/unverify', '[email protected]osit');
    Route::get('/finance/cash_deposits/verify', '[email protected]');
    Route::get('/finance/cash_deposits/decline', '[email protected]');
    Route::get('/finance/cash_deposits/edit', '[email protected]');
    Route::post('/finance/cash_deposits/edit', '[email protected]');
    Route::get('/finance/cash_deposits/add_driver_cash_deposits', '[email protected]');
    Route::post('/finance/cash_deposits/add_driver_cash_deposits', '[email protected]');

    Route::get('/finance/cod_reconcile', '[email protected]');
    Route::get('/finance/cod_reconcile/edit', '[email protected]');
    Route::post('/finance/cod_reconcile/edit', '[email protected]');

    Route::get('/finance/cc_payments', '[email protected]');
    Route::get('/finance/company_payments', '[email protected]');
    Route::get('/finance/company_payments/unverify', '[email protected]');
    Route::get('/finance/company_payments/verify', '[email protected]');

    Route::get('/notification', '[email protected]');
    Route::get('/notification/{id}/edit', '[email protected]');
    Route::post('/notification/{id}/edit', '[email protected]');
    Route::get('/notification/new', '[email protected]');
    Route::post('/notification/new', '[email protected]');
});

Routes in php artisan route:list

+--------+----------+--------------------------------------------+------+-----------------------------------------------------------------------+------------+
| Domain | Method   | URI                                        | Name | Action                                                                | Middleware |
+--------+----------+--------------------------------------------+------+-----------------------------------------------------------------------+------------+
|        | GET|HEAD | /                                          |      | App\Http\Controllers\Auth\[email protected]                     | guest      |
|        | POST     | auth/login                                 |      | App\Http\Controllers\Auth\[email protected]                    | guest      |
|        | GET|HEAD | auth/login                                 |      | App\Http\Controllers\Auth\[email protected]                     | guest      |
|        | GET|HEAD | auth/logout                                |      | App\Http\Controllers\Auth\[email protected]                    |            |
|        | GET|HEAD | dash                                       |      | App\Http\Controllers\[email protected]                             | auth       |
|        | GET|HEAD | dash/driver/list/{view?}                   |      | App\Http\Controllers\[email protected]                      | auth       |
|        | GET|HEAD | dash/driver/{did}/job                      |      | App\Http\Controllers\[email protected]                         | auth       |
|        | GET|HEAD | dash/driver/{did}/stat                     |      | App\Http\Controllers\[email protected]                        | auth       |
|        | GET|HEAD | dash/driver/{did}/view                     |      | App\Http\Controllers\[email protected]                   | auth       |
|        | GET|HEAD | dash/job/list/{view?}                      |      | App\Http\Controllers\[email protected]                            | auth       |
|        | GET|HEAD | dash/job/{jid}                             |      | App\Http\Controllers\[email protected]                            | auth       |
|        | GET|HEAD | dash/job/{jid}/dropoff_invoice/{iid}       |      | App\Http\Controllers\[email protected]                  | auth       |
|        | POST     | dash/job/{jid}/dropoff_status/{did}        |      | App\Http\Controllers\[email protected]                  | auth       |
|        | GET|HEAD | dash/job/{jid}/dropoff_status/{did}        |      | App\Http\Controllers\[email protected]                   | auth       |
|        | GET|HEAD | dash/map                                   |      | App\Http\Controllers\[email protected]                           | auth       |
|        | GET|HEAD | dash/map/driver/{id}                       |      | App\Http\Controllers\[email protected]                   | auth       |
|        | GET|HEAD | dash/map/job/{id}                          |      | App\Http\Controllers\[email protected]                      | auth       |
|        | GET|HEAD | dash/passenger/list                        |      | App\Http\Controllers\[email protected]                | auth       |
|        | GET|HEAD | dash/passenger/{id}/job                    |      | App\Http\Controllers\[email protected]                      | auth       |
|        | GET|HEAD | dash/passenger/{id}/view                   |      | App\Http\Controllers\[email protected]                      | auth       |
|        | GET|HEAD | dash/report                                |      | App\Http\Controllers\[email protected]                        | auth       |
|        | GET|HEAD | dash/report/affiliate_monthly_transactions |      | App\Http\Controllers\[email protected] | auth       |
|        | GET|HEAD | dash/report/driver_daily_transactions      |      | App\Http\Controllers\[email protected]      | auth       |
|        | GET|HEAD | dash/search/driver                         |      | App\Http\Controllers\[email protected]                    | auth       |
|        | GET|HEAD | dash/search/vehicle                        |      | App\Http\Controllers\[email protected]                   | auth       |
|        | GET|HEAD | dash/vehicle/list                          |      | App\Http\Controllers\[email protected]                    | auth       |
|        | GET|HEAD | dash/vehicle/{did}/view                    |      | App\Http\Controllers\[email protected]                 | auth       |
|        | POST     | media/{bucket}/upload                      |      | App\Http\Controllers\[email protected]                           |            |
|        | GET|HEAD | media/{bucket}/{folder}/{id}               |      | App\Http\Controllers\[email protected]                          |            |
+--------+----------+--------------------------------------------+------+-----------------------------------------------------------------------+------------+
Activity icon

Replied to Laravel Strange Routes Behavior

@GLOBALS - But the problem is all the routes are distinct routes.

Activity icon

Started a new conversation Laravel Strange Routes Behavior

I have routes files with more than 300 routes, but most of them is getting 404 error. I ran the php artisan route:list command and it only showing 40 routes. Can someone suggest me what are the criteria for registering a laravel route?

Apr
03
1 year ago
Mar
26
1 year ago
Activity icon

Started a new conversation Save Query On Db Listen Event

I have a requirement that I need to save each and every query executed by the laravel program. I have created following listener in boot method of app/Http/Providers/AppServiceProvider

    public function boot()
    {
        DB::listen(
            function ($query) {
                $query_binding = '';
                foreach ($query->bindings as $binding) {
                    $query_binding .= $binding . ', ';
                }
                QueryLog::create([
                    'sql' => $query->sql,
                    'bindings' => $query_binding,
                    'time' => $query->time
                ]);
            }
        );
    }

I get following error:

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'bindings' at row 1 (SQL: insert into query_log (sql, bindings, time, updated_at, created_at) values (insert into query_log (sql, bindings, time, updated_at, created_at) values (insert into query_log (sql, bindings, time, updated_at, created_at) values (0.17, 2018-03-26 07:27:36, 2018-03-26 07:27:36, ?, ?), insert into query_log (sql, bindings, time, updated_at, created_at) values (?, ?, ?, ?, ?), select * from users where id = ? limit 1, 3, , 2.63, 2018-03-26 07:27:36, 2018-03-26 07:27:36, , 0.23, 2018-03-26 07:27:36, 2018-03-26 07:27:36, , 0.17, 2018-03-26 07:27:36, 2018-03-26 07:27:36, , ?, ?, ?, ?), ?, ?, ?, ?))

I believe this is due to the DB::listen listen to its own query and try to save it creates an infinite loop.

How to exclude the saving query of DB::listen and save all the other queries?

Feb
05
1 year ago
Activity icon

Replied to V-for Not Working For Select Tag Options.

Any update on this? Is this still an issue?

Jan
31
1 year ago
Activity icon

Replied to Reactivity Is Lost Inside V-for

@arukomp I used this as:

this.$set(selected_user[0], 'active', true);

and it worked! Thanks a lot!

Activity icon

Replied to Why Laravel Not Returning Eloquent Model Data As Integer But Returns String?

Is there any other solution than casting in the model? If the database is big casting all fields in all models is not practical solution? Also how to cast datatypes to pivot tables?

Jan
30
1 year ago
Activity icon

Replied to Reactivity Is Lost Inside V-for

@arukomp Thanks for the first suggestion. I have removed filter from the funtion. And for the question, this.users have active property initially set to false.

Jan
29
1 year ago
Activity icon

Replied to Reactivity Is Lost Inside V-for

@bobbybouwmann Thanks. I tried the $set method but it gave me undefined method.

Activity icon

Started a new conversation Reactivity Is Lost Inside V-for

I have following scenario.

I have users object which has active field with boolean values.

Initially the HTML is loaded with users as follows:

<tr v-for="user in users">
                                    <td class="col-1">@{{user.name}}</td>
                                    <td class="col-2"><a href="#" @click="setActive(user.id,$event)">
                                            <img class="svg Green" :class="{'active':user.active}"
                                                 src="image.jpg"
                                                 alt="info" width="33" height="33"></a></td>
                                </tr>

I have following Vue js code:

var vue_users = new Vue({
            data: data,
            el: '#users',
            methods: {
                setActive: function (user_id, event) {
                    event.preventDefault();
                    var filtered_user = this.users.filter(function (user) {
                        return user.id == user_id;
                    });

                    var $this = this;

                    axios.post('ajax-url'}', {
                        user_id: filtered_user[0].id
                    })
                        .then(function (response) {
                            if (response.data.status == 'success') {
                                $this.resetButtons(user_id);
                            }
                        })
                        .catch(function (error) {
                            console.log(error);
                        });
                },
                resetButtons: function (user_id) {
                    var selected_user = this.users.filter(function (user) {
                        return user.id == user_id;
                    });

                        selected_user[0].active = true;
                }
            }
        });

The problem is this updates the user object, but changes does not showing in the DOM. Can anyone suggest what is the wrong with this code? Help is appreciated. Thanks.

Nov
28
1 year ago
Activity icon

Replied to SPA Tokens And Laravel

I'm not clear about the internal Vue - Laravel relationship, if your page routes are served by laravel then everything should work fine in web routing, you don't need any api authenication. But if your page routes are handled by vue, then the problem is there is no session cookie in your client side app, so you need api authentication no matter if it is internal or not.

Activity icon

Replied to SPA Tokens And Laravel

First you need to deploy keys with php artisan passport:keys Then you need to login a user via oauth/token with

{
    "client_id":"client_id",
    "client_secret":"client_secret",
    "grant_type":"password",
    "username":"email/username",
    "password":"password",
    "scope":"*"
}

Then it will return a access token, which you need to add as a bearer token. Have you tried that?

Activity icon

Replied to SPA Tokens And Laravel

If you are using web routes, that means you are using sessions for authentication, which you don't on a SPA. You need to install Passport and create oauth authentication or any other token based stateless authentication method to constantly keep logged in to the laravel application.

##Where I am confused:

What complete adjustments to the framework, dependencies, VueJS, or even my methodology is needed to get this token exchange working?

Like I said, first you need to create api routes in routes/api.php instead web routes.

Then you need to implement separate token based authentication method(laravel recommendation is passport: https://laravel.com/docs/5.5/passport) to keep your user's state.

Nov
16
1 year ago
Activity icon

Started a new conversation Get JSON Response Instead Of Login Form With Passport

I have successfully installed passport and started to code an API. When I guard my routes with passport, if not logged in, I get login form as response.

in routes/api.php,

Route::middleware('auth:api')->get('/', '[email protected]');

How do I get JSON response instead of login form HTML?

Oct
30
1 year ago
Activity icon

Replied to Passport

bump

Oct
26
1 year ago
Activity icon

Replied to Wildcard Route

@WeeHong I think not.

So, I don't need to create new route again and again whenever I created a new category.

Then you have to create new case again and again whenever you create a new category. I think your approach is difficult. Try to parametrize a layout with the values from urls rather than create a layout for each url.

Oct
18
1 year ago
Activity icon

Started a new conversation For Loop And Axios

I have following scenario where I have to call a third party API for each item in Vue object. I call it as follows:

var $this = this;
for (var i = 0; i < $this.items.length; i++) {
  axios.get('https://thirdpartyapi.com/api/' + $this.items[i].somevalue)
    .then(function(response) {
      if (somevarialble.toLowerCase() == response.data[0].itemValue.toLowerCase()) {
        $this.filteredItems.push($this.items[i]);
      }
    })
    .catch(function(error) {
      console.log(error);
    });
}

But I always get i as 62(which is the last one). How to pass i inside axios?

Oct
11
2 years ago
Activity icon

Replied to How To Iterate Thorough A Vue Data Inside Mounted?

@Yeman: I get TypeError: this.cart.forEach is not a function

Activity icon

Started a new conversation How To Iterate Thorough A Vue Data Inside Mounted?

Hello,

I have following setup.

var data = {
    items: [],
    total: 0
};

var cart = new Vue({
    el: '#root',
    data: data,
    mounted: function () {
        var $this = this;
        axios.get(vue_items_url).then(function (response) {
            $this.items = response.data;
            var total = 0;
            for (var i = 0; i < $this.items.length; i++) {
                total += $this.items[i].price * $this.items[i].qty;
            }
            $this.total = total;
        }).catch(function (error) {
            console.log(error);
        });
    }
});

This does not iterate through items array. How to iterate through Vue object? Is there any proper way?

Oct
07
2 years ago
Activity icon

Replied to Problem With Accessing Local Symbolic Link In Storage

@Dry7 This outputs: /storage/2017/10/file.txt but still 404 :(

Activity icon

Started a new conversation Problem With Accessing Local Symbolic Link In Storage

Hi,

I created my symbolic link with php artisan storage:link

I save my files in following function:

Storage::put( Carbon::now()->format( 'Y' ) . '/' . Carbon::now()->format( 'm' ), 'file.txt' );

My config/filesystems.php configurations:

'local' => [
            'driver' => 'local',
            'root' => storage_path('uploads'),
        ],
        'public' => [
            'driver' => 'local',
            'root' => storage_path('uploads'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

The files are saved in the storage/uploads/2017/10 directory, which is what I want.

I access them as follows:

{{URL::to('storage/2017/10/file.txt')}}

which outputs: http://localhost/mysite/public/storage/2017/10/file.txt and it gives 404.

When I try to enter http://localhost/mysite/public/storage it shows empty directory, not a 404.

Can you guys give any suggestions or ideas? Help is appreciated. Thanks.