sanjayacloud

sanjayacloud

Member Since 1 Year Ago

Experience Points
5,150
Total
Experience

4,850 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
8
Lessons
Completed
Best Reply Awards
0
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 2
5,150 XP
Oct
10
1 week ago
Activity icon

Replied to Auth Middleware Error.

After clear all cache it solved.

Activity icon

Replied to Auth Middleware Error.

Problem solved. Thanks all of you for your attention.

Activity icon

Replied to Auth Middleware Error.

Ok will try.

Activity icon

Replied to Auth Middleware Error.

@munazzil You mean Admin Middleware (Admin.php) right?

Activity icon

Replied to Auth Middleware Error.

@sinnbeck @bobbybouwmann Here's my kernal.php

  protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
        'admin' => \App\Http\Middleware\Admin::class,
    ];

Activity icon

Started a new conversation Auth Middleware Error.

Hi Everyone,

I am trying to make auth middleware call "Admin" And it registered on http kernal. But when i add it into my controller in constructor. I got below error.

Error: "Class admin does not exist"

My constructor

public function __construct()
    {
        $this->middleware(['auth','admin']);
    }

And below my middleware

<?php

namespace App\Http\Middleware;

use Closure;

class Admin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(auth()->user()->role == 5){
            $response = $next($request);
            $response->header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0')->header('Pragma', 'no-cache')->header('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT');
            return $response;
        }
        return redirect('/admin/login')->with('login-msg','You have not admin access');
    }
}

Anyone can help me to resolve this error?

Oct
09
1 week ago
Activity icon

Replied to Logout Error.

@nakov You are correct. That's why it does not work. After I remove href value and replace it with"#" it's work

Activity icon

Replied to Logout Error.

@bobbybouwmann My route list has a logout post method. here's my route list.

+--------+-----------+------------------------------+--------------------+------------------------------------------------------------------------+--------------+
| Domain | Method    | URI                          | Name               | Action                                                                 | Middleware   |
+--------+-----------+------------------------------+--------------------+------------------------------------------------------------------------+--------------+
|        | GET|HEAD  | /                            |                    | App\Http\Controllers\[email protected]                            | web          |
|        | GET|HEAD  | about                        |                    | App\Http\Controllers\[email protected]                            | web          |
|        | GET|HEAD  | api/user                     |                    | Closure                                                                | api,auth:api |
|        | GET|HEAD  | checkout/{id}                |                    | App\Http\Controllers\[email protected]                         | web          |
|        | GET|HEAD  | contact                      |                    | App\Http\Controllers\[email protected]                          | web          |
|        | POST      | contact                      |                    | App\Http\Controllers\[email protected]                           | web          |
|        | GET|HEAD  | home                         | home               | App\Http\Controllers\[email protected]                          | web          |
|        | GET|HEAD  | hosting                      |                    | App\Http\Controllers\[email protected]                          | web          |
|        | GET|HEAD  | login                        | login              | App\Http\Controllers\Auth\[email protected]                | web,guest    |
|        | POST      | login                        |                    | App\Http\Controllers\Auth\[email protected]                        | web,guest    |
|        | POST      | logout                       | logout             | App\Http\Controllers\Auth\[email protected]                       | web          |
|        | POST      | password/email               | password.email     | App\Http\Controllers\Auth\[email protected]  | web,guest    |
|        | POST      | password/reset               | password.update    | App\Http\Controllers\Auth\[email protected]                | web,guest    |
|        | GET|HEAD  | password/reset               | password.request   | App\Http\Controllers\Auth\[email protected] | web,guest    |
|        | GET|HEAD  | password/reset/{token}       | password.reset     | App\Http\Controllers\Auth\[email protected]        | web,guest    |
|        | POST      | payment                      |                    | App\Http\Controllers\[email protected]                           | web          |
|        | GET|HEAD  | projects                     |                    | App\Http\Controllers\[email protected]                         | web          |
|        | GET|HEAD  | publicView                   | publicView.index   | App\Http\Controllers\[email protected]                            | web          |
|        | POST      | publicView                   | publicView.store   | App\Http\Controllers\[email protected]                            | web          |
|        | GET|HEAD  | publicView/create            | publicView.create  | App\Http\Controllers\[email protected]                           | web          |
|        | GET|HEAD  | publicView/{publicView}      | publicView.show    | App\Http\Controllers\[email protected]                             | web          |
|        | PUT|PATCH | publicView/{publicView}      | publicView.update  | App\Http\Controllers\[email protected]                           | web          |
|        | DELETE    | publicView/{publicView}      | publicView.destroy | App\Http\Controllers\[email protected]                          | web          |
|        | GET|HEAD  | publicView/{publicView}/edit | publicView.edit    | App\Http\Controllers\[email protected]                             | web          |
|        | POST      | quotation                    |                    | App\Http\Controllers\[email protected]                         | web          |
|        | POST      | register                     |                    | App\Http\Controllers\Auth\[email protected]                  | web,guest    |
|        | GET|HEAD  | register                     | register           | App\Http\Controllers\Auth\[email protected]      | web,guest    |
|        | GET|HEAD  | services                     |                    | App\Http\Controllers\[email protected]                         | web          |
|        | GET|HEAD  | user/help                    |                    | App\Http\Controllers\[email protected]                            | web          |
|        | GET|HEAD  | user/orders                  |                    | App\Http\Controllers\[email protected]                          | web          |
|        | GET|HEAD  | user/portal                  |                    | App\Http\Controllers\[email protected]                          | web          |
|        | POST      | user/ticket                  |                    | App\Http\Controllers\[email protected]                          | web          |
|        | GET|HEAD  | vps                          |                    | App\Http\Controllers\[email protected]                             | web          |
+--------+-----------+------------------------------+--------------------+------------------------------------------------------------------------+--------------+

Activity icon

Started a new conversation Logout Error.

Hello friend,

I have an error when trying to logout from system, It's says "Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException"

This is my logout form

@if(Auth::check())
                                            <a data-content="inline" data-aux-classes="tml-form-modal height-auto" data-toolbar="" data-modal-mode data-modal-width="500" data-modal-animation="scaleIn" data-lightbox-animation="fadeIn" href="{{url('user/portal')}}" class="button small rounded no-label-on-mobile no-margin-bottom fade-location client-portal"><span class="icon-lock left"></span><span class="hide-on-mobile">Client Portal</span></a>
                                               <a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" data-content="inline" data-aux-classes="tml-form-modal height-auto" data-toolbar="" data-modal-mode data-modal-width="500" data-modal-animation="scaleIn" data-lightbox-animation="fadeIn" class="button small rounded no-label-on-mobile no-margin-bottom fade-location client-portal"><span class="icon-log-out left"></span><span class="hide-on-mobile">Logout</span></a>
                                            <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                                @csrf
                                            </form>
                                        @else
                                            <a data-content="inline" data-aux-classes="tml-form-modal height-auto" data-toolbar="" data-modal-mode data-modal-width="500" data-modal-animation="scaleIn" data-lightbox-animation="fadeIn" href="{{url('login')}}" class="button small rounded no-label-on-mobile no-margin-bottom fade-location client-portal"><span class="icon-lock left"></span><span class="hide-on-mobile">Client Portal</span></a>
                                        @endif

And this is my logout method,

 public function logout(Request $request) {
        Auth::logout();
        return redirect('/login');
    }

Can anyone help me?

Sep
30
2 weeks ago
Activity icon

Replied to Cannot Load Routes From Database

@filipc Thanks. Its work.

Activity icon

Replied to Cannot Load Routes From Database

@siangboon How Can i do that?

If I echo the output in route Its look like below.

{"id":1,"title":"Route Permission","route_name":"permission","method_type":"get","controller_name":"RoutePermissionController","method_name":"index","created_at":"2019-09-30 12:11:22","updated_at":"2019-09-27 13:03:56"}
Activity icon

Started a new conversation Cannot Load Routes From Database

Hi Friends,

I want load routes from database & access it. I have load routes from database But its says 404 error. But That Route is there & Also controller method is there.

My web.php like below.

$routes = \App\Route::all();

foreach ($routes as $route){
    $method_type = $route->method_type;
    Route::$method_type("'".$route->route_name."'", "'".$route->controller_name."@".$route->method_name."'");

    echo $route;
}

Controller Code.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class RoutePermissionController extends Controller
{
    public function index()
    {
        echo "Test";
    }
}

Activity icon

Replied to Access To Undeclared Static Property: Illuminate\Support\Facades\Route::$route

I followed your steps. Then I have error like below.


My Code.

$routes = \App\Route::all();
foreach ($routes as $route){
    $method = $route->method_type($route->route_name, $route->controller_name . '@' . $route->method_name);
    Route::$method;
}
Activity icon

Replied to Access To Undeclared Static Property: Illuminate\Support\Facades\Route::$route

@bobbybouwmann & @resin Sorry. I lost my full code posted to in this post. This is the full code.

$routes = \App\Route::all();
foreach ($routes as $route){
    Route::$route->method_type("'".$route->route_name."'", "'".$route->controller_name."@".$route->method_name."'");
}
Activity icon

Started a new conversation Access To Undeclared Static Property: Illuminate\Support\Facades\Route::$route

Hi Guys,

I am trying to load routes from database. When i am trying to load I got below error.

Error

  Symfony\Component\Debug\Exception\FatalThrowableError  : Access to undeclared static property: Illuminate\Support\Facades\Route::$route

  at E:\xampp\htdocs\projects\client\laravel_admin_panel\routes\web.php:35
    31|
    32| $routes = \App\Route::all();
    33|
    34| foreach ($routes as $route){
  > 35|     Route::$route->method_type("'".$route->route_name."'", "'".$route->controller_name."@".$route->method_name."'");
    36| }
    37|
    38|

  Exception trace:

  1   require()
      E:\xampp\htdocs\projects\client\laravel_admin_panel\vendor\laravel\framework\src\Illuminate\Routing\RouteFileRegistrar.php:35

  2   Illuminate\Routing\RouteFileRegistrar::register(Object(Illuminate\Database\Eloquent\Collection))
      E:\xampp\htdocs\projects\client\laravel_admin_panel\vendor\laravel\framework\src\Illuminate\Routing\Router.php:415
  Please use the argument -v to see more details.

My Code in web.php

foreach ($routes as $route){
    Route::$route->method_type("'".$route->route_name."'", "'".$route->controller_name."@".$route->method_name."'");
}
Sep
24
3 weeks ago
Activity icon

Replied to Artisan Command Not Work

Thanks. It's work @snapey

Activity icon

Replied to Artisan Command Not Work

Then I got below error

My Error, Symfony\Component\Console\Exception\InvalidArgumentException The "CategoryController" argument does not exist.

My Method

public function create()
    {
        $exitCode = Artisan::call('make:controller', [
            'CategoryController' => true,
        ]);
      return $exitCode;
    }

Activity icon

Started a new conversation Artisan Command Not Work

Hi Guys,

I want to run artisan command from my method. when I trying make controller through my method, I got below error, Can anyone help me for do this?

Error,

Symfony\Component\Debug\Exception\FatalThrowableError Argument 2 passed to Illuminate\Foundation\Console\Kernel::command() must be an instance of Closure, string given, called in E:\xampp\htdocs\projects\client\laravel_admin_panel\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 239

My method,

 public function create()
    {
      $ct = Artisan::command('make:controller', 'CategoryController');
      return back();
    }

Sep
05
1 month ago
Activity icon

Started a new conversation How To Change File Upload Directory In Unisharp/laravel-filemanager Public Folder To Storage Folder ?

Does anyone know, How to change file upload directory in unisharp/laravel-filemanager public folder to storage folder ?

Aug
29
1 month ago
Activity icon

Started a new conversation Can I Know, How To Use Unisharp/laravel-filemanager Without Login ?

Anyone can help me, how to use unisharp/laravel-filemanager without login?

Aug
28
1 month ago
Activity icon

Replied to How To Check If Voucher Is Expired After It Purchased One Year.?

This is what i am tried. Its not work.

$voucher = Voucher::where('code', $request->code)->first();

        $today = date("Y-m-d H:i:s");
        $startdate = $voucher['created_at'];
        $offset = strtotime("+365 day");
        $enddate = date($startdate, $offset);
        $today_date = new  \DateTime($today);
        $expiry_date = new \DateTime($enddate);

        if ($expiry_date < $today_date) {

            return response()->json(['error' =>"Voucher is expired"]);
        }

Activity icon

Started a new conversation How To Check If Voucher Is Expired After It Purchased One Year.?

Hi Guys,

I am building a voucher generate system in laravel. This voucher validity period is one year. Now i want do is when user trying to redeem a voucher then user cannot do it because of it is expired. Any one can help me to do this. Because I don't have any idea about this.

Jul
31
2 months ago
Activity icon

Replied to Datatable Date Sort Not Work.

I have used that. but still not work

here's the code.

  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
    <script src="https://cdn.datatables.net/plug-ins/1.10.12/sorting/datetime-moment.js"></script>
<script>
    $(document).ready(function () {
        $.fn.dataTable.moment( 'DD/MM/YYYY' );
        $('#purchase-history').daterangepicker(null, function (start, end, label) {
            bringData( start.format('YYYY-MM-DD') , end.format('YYYY-MM-DD'));
        });
        bringData('{{date("Y/m/d" , strtotime("-1 months"))}}' , '{{date("Y/m/d")}}');
        function bringData(start, end) {
            $.ajax({
                url: base + '/admin/used-boxes-data',
                type: 'post',
                data: 'start='+start+'&end='+end,
                async: false,
                success: function (respond) {
                    if (respond.success) {
                        $('#content').html(respond.data);
                          $("#used").DataTable({
                              ordering: true,
                              paging: true,
                              searching: true,
                                dom: "Blfrtip",
                                buttons: [
                                    {
                                        extend: "copy",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "csv",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "excel",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "pdfHtml5",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "print",
                                        className: "btn-sm"
                                    }
                                ],
                                responsive: true,
                                order: [[ 2, "desc" ]],
                            });

                    } else {

                    }
                },
                complete: function () {
                }
            });
        }
    });
</script>

Any idea?

Activity icon

Started a new conversation Datatable Date Sort Not Work.

Hi I have use datatable in my project. I want to sort my date column. Its not work. But other column sort work fine. here's my code.

  $(document).ready(function () {
        $('#purchase-history').daterangepicker(null, function (start, end, label) {
            bringData( start.format('YYYY-MM-DD') , end.format('YYYY-MM-DD'));
        });
        bringData('{{date("Y/m/d" , strtotime("-1 months"))}}' , '{{date("Y/m/d")}}');
        function bringData(start, end) {
            $.ajax({
                url: base + '/admin/used-boxes-data',
                type: 'post',
                data: 'start='+start+'&end='+end,
                async: false,
                success: function (respond) {
                    if (respond.success) {
                        $('#content').html(respond.data);
                          $("#used").DataTable({
                                dom: "Blfrtip",
                                buttons: [
                                    {
                                        extend: "copy",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "csv",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "excel",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "pdfHtml5",
                                        className: "btn-sm"
                                    },
                                    {
                                        extend: "print",
                                        className: "btn-sm"
                                    }
                                ],
                                responsive: true,
                              order: [[ 1, "desc" ]],
                              columnDefs : [{"targets":1, "type":"date-eu"}],
                            });

                    } else {

                    }
                },
                complete: function () {
                }
            });
        }
    });
Jul
29
2 months ago
Jul
27
2 months ago
Activity icon

Started a new conversation How To Pass To Email For Laravel Notification

Hi, I want to know how to pass to email for below method.

public function sendOrderSummeryMessage($cartItems , $price , $orderId , $date) {
        return $this->notify(new OrderSummeryMessage($this->first_name , $cartItems , $price , $orderId , $this->user , $date ));
    }
Jul
23
2 months ago
Activity icon

Replied to Ajax Request Not Work

Yes. I add it like this.

Activity icon

Replied to Ajax Request Not Work

Not work.

Jul
21
2 months ago
Activity icon

Started a new conversation Ajax Request Not Work

Hi all,

I am trying to send ajax form request but when I click on the submit button my page is reloaded. And say "The POST method is not supported for this route. Supported methods: GET, HEAD."

Thus is my form

  <form id="user-update" class="form-horizontal form-label-left input_mask" action=""
                                                                          method="POST">
                                                                        @csrf
                                                                        <div class="col-md-6 col-sm-12 col-xs-12">
                                                                            <div class="form-group ">
                                                                                <label>Name</label>
                                                                                <input type="text" id="name"
                                                                                       class="form-control validation {{ $errors->has('name') ? ' is-invalid' : '' }}"
                                                                                       name="name"
                                                                                       value="{{ old('name') }}">
                                                                                <span class="invalid-feedback error"
                                                                                      role="alert"
                                                                                      style="display: none;">
                                                                                </span>
                                                                            </div>
                                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-default" onclick="location.reload();">Close</button>
                                                            <button type="submit" class="btn btn-success btn-send">Update user</button>
                                                        </div>
                                                        </form>

And this is my JS function

            e.preventDefault();
            $.ajax({
                url: base+'/profile/store',
                type: 'POST',
                data: new FormData(this),
                contentType: false,
                cache: false,
                processData: false,
                beforeSend: function () {
                    $('.btn-send').html('Updating...').attr('disabled', true).addClass('disabled');
                    $('.btn-send').attr('disabled', true).addClass('disabled');
                },
                success: function (data) {
                    if (data.success) {
                        swal({
                            title: "Good job!",
                            text: data.success,
                            icon: "success",
                        });
                        $('#user-update').each(function () {
                            this.reset();
                        });
                    } else {
                        printErrorMsg(data.error);
                    }
                },
                complete: function () {
                    $('.btn-send').html('Update user').attr('disabled', false).removeClass('disabled');
                    $('.btn-send').attr('disabled', false).removeClass('disabled');
                }
            });
        });
        function printErrorMsg (msg) {
            $(".print-error-msg").find("ul").html('');
            $(".print-error-msg").css('display','block');
            $.each( msg, function( key, value ) {
                $(".print-error-msg").find("ul").append('<li>'+value+'</li>');
            });
        }

This my controller method

public function store(Request $request)
    {
        $validate = Validator::make($request->all(), [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        ]);

        if ($validate->fails()){
            return response()->json(['error'=> $validate->errors()->all()]);
        }
    }
``

This is my route

Route::post('/profile/store', '[email protected]');


Can anyone help me to resolve this? Where I am wrong?
Jul
17
3 months ago
Activity icon

Started a new conversation Error SQLSTATE[22007]: Invalid Datetime Format: 1366 Incorrect String Value: '\xC5\x8D-tan...' In Laravel

Hi all,

I got above error "SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xC5\x8D-tan...' in laravel" when insert strings. anyone can explain me, whay that error is getting. My column Collation is utf8mb4_unicode_ci

Jul
06
3 months ago
Activity icon

Replied to Cannot Load Image To Pdf With Barryvdh/laravel-dompdf

Is there any way to make the grid as bootstrap grid to this pdf file?

Activity icon

Replied to Cannot Load Image To Pdf With Barryvdh/laravel-dompdf

When I execute it as a php blade file, It's load correctly with an image. But cannot generate pdf with an image it does not work.

Activity icon

Started a new conversation Cannot Load Image To Pdf With Barryvdh/laravel-dompdf

Hi everyone,

I am trying to generate pdf attached to my logo. but it does not work. I got the below error. But If i trying to generate pdf without image its generate properly. Also, bootstrap 4 grid does not work properly

Error. " Maximum execution time of 60 seconds exceeded"

Controller method

public function index()
    {
        $pdf = PDF::loadView('quotations.index');
        //$pdf->setPaper('A4', 'portrait');
        return $pdf->download('quotation.pdf');
        
    }

my view file code

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <title>Quotation N0: </title>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-6">
            <h3 class="text-danger">Quotation</h3>
        </div>
        <div class="col-6">
            <img src="{{ asset('imgs/logo.png')}}" alt="BTS" width="100">
        </div>
    </div>
</div>

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>

Jul
03
3 months ago
Activity icon

Replied to Trying To Get Property Of Non-object

@RAS1212 - Thanks. It's work

Activity icon

Replied to Trying To Get Property Of Non-object

@NAKOV - I have got the same error. I don't know why. Because my other relationships are working fine.

Activity icon

Replied to Trying To Get Property Of Non-object

@NAKOV - The same error got. Any idea?

Activity icon

Started a new conversation Trying To Get Property Of Non-object

Hi,

I have got "Trying to get property of non-object" error when I get the user name from ORM. My code like below,

User model method

public function Quotation(){
        return $this->hasMany('App\Quotation');
    }

Quotation model method

 public function users(){
        return $this->belongsTo('App\User', 'user_id');
    }

Quotation controller method

 public function index()
    {
        $title = "All Projects";
        $data = Quotations::all();
        return view('projects.index', compact('title','data'));
    }

View file

<table id="datatable" class="table">
                                <thead>
                                <tr>
                                    <th>Quotation No</th>
                                    <th>Started Date</th>
                                    <th>Total Cost</th>
                                    <th>Created by</th>
                                    <th>Edit</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $item)
                                    <tr>
                                        <td>{{ $item->q_number}}</td>
                                        <td>{{$item->created_at}}</td>
                                        <td>{{$item->total_cost}}</td>
                                        <td>{{$item->users->name}}</td>
                                        <td><a class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-{{$item->id}}"><i class="fa fa-pencil-square-o"></i></a></td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>

Issue is $item->users->name , Its come from User model with above relationship

Activity icon

Replied to How To Get Sum From Inside The Foreach

@SNAPEY - Thanks. Your answer very simple and its best.

Jul
02
3 months ago
Activity icon

Started a new conversation How To Get Sum From Inside The Foreach

Hi everyone,

I am passing cost array like

 <input name="cost[]" />

in my method I do like below to save it to database

$itemsArray = array();
        $i = 1;
        foreach($request['cost'] as $cost){
            $itemsArray[$i] = $cost;
            $i++;
        }

$data = new model;
$data->cost =  json_encode($itemsArray);

I wan to get sum of all these cost array. Anyone have idea about how to do this calculation ?

Jun
16
4 months ago
Jun
12
4 months ago
Activity icon

Started a new conversation Instagram Feed Cannot Get With Vinkla Instagram Package.

Hello everyone,

I am trying to get instagram feed data user Vinkla Instagram package. I have followed steps that they given, It as followed.

 $instagram = new Instagram('my_access_token');
        $instagram->media(['count' => 5]);
       dd($instagram);

But i didn't get any data. I got below result.

Instagram {#202 ▼ #accessToken: "my_access_token" #httpClient: Client {#197 ▶} #requestFactory: GuzzleMessageFactory {#213} #request: null }

Can anyone help me to resolve this thing.

May
14
5 months ago
Activity icon

Replied to "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@SNAPEY - But. If I directly access these routs, It's work. why for only this redirection?

Activity icon

Replied to "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@SNAPEY - I got point where exactly error is coming. When i add below code to my LoginController to redirect to specific paths based on user role. Once I comment that this error doesn't come. See below my Login Controller.

<?php

namespace App\Http\Controllers\Admin\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class AdminLoginController extends Controller {
    /*
      |--------------------------------------------------------------------------
      | Login Controller
      |--------------------------------------------------------------------------
      |
      | This controller handles authenticating users for the application and
      | redirecting them to your home screen. The controller uses a trait
      | to conveniently provide its functionality to your applications.
      |
     */

use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
   // protected $redirectTo = 'admin/product';

    /**
     * Show the application's login form.
     *
     * @return \Illuminate\Http\Response
     */
    public function showLoginForm() {
        return view('admin.auth.login');
    }

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct() {
        $this->middleware('guest')->except('logout');
    }

    /**
     * Log the user out of the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function logout(Request $request) {
        $this->guard()->logout();
        $request->session()->invalidate();
        return $this->loggedOut($request) ?: redirect('admin.auth.login');
    }

//    public function redirectTo()
//    {
//        if (auth()->user()->role == '0') {
//            return redirect('/');
//        } elseif (auth()->user()->role == '1' && auth()->user()->status == '1'){
//            return redirect('admin/experience');
//        }elseif (auth()->user()->role == '5'){
//            return redirect('admin/dashboard');
//        }
//    }


}

Activity icon

Replied to "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@MUNAZZIL - This is my layout.site file

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- CSRF Token -->
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>

        <!-- Fonts -->
        <link rel="dns-prefetch" href="//fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">

        <!-- Styles -->
        <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    </head>
    <body>
        <div id="app">
            <nav class="navbar navbar-expand-md navbar-light navbar-laravel">
                <div class="container">
                    <a class="navbar-brand" href="{{ url('/') }}">
                        {{ config('app.name', 'Laravel') }}
                    </a>
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
                        <span class="navbar-toggler-icon"></span>
                    </button>

                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <!-- Left Side Of Navbar -->
                        <ul class="navbar-nav mr-auto">

                        </ul>

                        <!-- Right Side Of Navbar -->
                        <ul class="navbar-nav ml-auto">
                            <!-- Authentication Links -->
                            @guest
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
                            </li>
                            @if (Route::has('register'))
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
                            </li>
                            @endif
                            @else
                            <li class="nav-item dropdown">
                                <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                                    {{ Auth::user()->name }} <span class="caret"></span>
                                </a>

                                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="{{ route('logout') }}"
                                       onclick="event.preventDefault();
                                               document.getElementById('logout-form').submit();">
                                        {{ __('Logout') }}
                                    </a>

                                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                        @csrf
                                    </form>
                                </div>
                            </li>
                            @endguest
                        </ul>
                    </div>
                </div>
            </nav>
            <main class="py-4">
                @yield('content')
            </main>
        </div>
        <!-- Scripts -->
        <script>
            var base = '{{url(' / ') . ' / '}}';
        </script>
        <script src="{{ asset('js/app.js') }}" defer></script>
        <script src="{{asset('assets/frontend/js/jquery.sticky.js')}}"></script>
    </body>
</html>


Activity icon

Replied to "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@DEVFREY - II have check my files there aren't any white space found. Can you help me. please check reply. I have added my blade file.

Activity icon

Replied to "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@MUNAZZIL - This my blade file. There are know find any issue. Can you check it?

@extends('layouts.site')
@section('content')
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">{{ __('Admin Login') }}</div>

                    <div class="card-body">
                        <form method="POST" action="{{ route('admin.login') }}">
                            @csrf

                            <div class="form-group row">
                                <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>

                                <div class="col-md-6">
                                    <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>

                                    @if ($errors->has('email'))
                                        <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row">
                                <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>

                                <div class="col-md-6">
                                    <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

                                    @if ($errors->has('password'))
                                        <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-md-6 offset-md-4">
                                    <div class="form-check">
                                        <input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>

                                        <label class="form-check-label" for="remember">
                                            {{ __('Remember Me') }}
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row mb-0">
                                <div class="col-md-8 offset-md-4">
                                    <button type="submit" class="btn btn-primary">
                                        {{ __('Login') }}
                                    </button>

                                    @if (Route::has('password.request'))
                                        <a class="btn btn-link" href="{{ route('password.request') }}">
                                            {{ __('Forgot Your Password?') }}
                                        </a>
                                    @endif
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

May
13
5 months ago
Activity icon

Started a new conversation "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

Hi,

I have above error after user login my admin login controller. My controller like below.

<?php
namespace App\Http\Controllers\Partner\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
  

    use AuthenticatesUsers;
    
    public function showLoginForm()
    {
        return view('partner.auth.login');
    }

    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    public function redirectTo()
    {
        if (Auth::user()->role == '0') {
            return redirect('/');
        } elseif (Auth::user()->role == '1' && Auth::user()->status == '1'){
            return redirect('admin/experience');
        }elseif (Auth::user()->role == '5'){
            return redirect('admin/dashboard');
        }
    }
}

Can anyone help me for resolve this error?

May
07
5 months ago
Activity icon

Replied to HTML Array Not Work With Table

@FORAM - Ididnot understand. How can i do it

Activity icon

Started a new conversation Load File Path In Html Input (default Value)

Hi Guys,

I am trying to update images where coming from array. I want to know how to load image file path in input value. I did it like

<input type="file" id="action_json" name="featured_image[]" class="form-control" value="{{$obj2->image}}">

After that I got "getClientOriginalExtension() on null " Error. Anyone has a solution for this. My image path save in database column like below.

{["image":"UyxiIclQSQ1556793102.png"},"image":"Rdfl1KVgug1556793102.png"}]