adnan483

adnan483

Member Since 1 Year Ago

Experience Points 1,870
Experience Level 1

3,130 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 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.

09 Jul
1 week ago

adnan483 left a reply on Button Not Responding On Update

Thank you for your response, that code works fine, problem was something with jquery, which prevent button to be clicked.

adnan483 started a new conversation Button Not Responding On Update

I have problem with updating, when I click on button nothing happened. controller

public function update(Request $request, $id){
    $year = Year::latest()->first();
    DB::table('nalogs')
          ->where('id', $id)
          ->update(['reported' => 1]);
    return redirect()->back();
  }

view

<form method="post" action="/montage/edit/{{$n1->id}}">
 @method('PATCH')
@csrf
<button type="submit" class="btn btn-outline-primary">Report</button>
 </form>

route

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

23 Jun
3 weeks ago

adnan483 left a reply on Laravel Testing

@TRAY2 - thank you Tray, that's it!

adnan483 left a reply on Laravel Testing

@FUTUREFUTURE - There is no error, all tests passed, but on every run I have new company added, but non of them is edited or deleted.

22 Jun
3 weeks ago

adnan483 started a new conversation Laravel Testing

hi, I'm new to testing, and I have there three tests, but they are not working, what is wrong here?

/** @test */
  public function can_add_new_company()
    {
        $data = [
            'name' => 'Apple',
            'email' => '[email protected]',
            'website' => 'www.apple.com'
        ];
        $this
            ->post(route('company.store', $data))
            ->assertStatus(302);
    }

for editing

/** @test */
    public function can_update_the_company()
    {
        $company = factory(Company::class)->create();
        $data = ['name' => 'Edited NAME!'];
        $this
            ->put(route('company.update', $company->id), $data)
            ->assertStatus(302);
    }

and for deleting

/** @test */
    public function can_delete_the_company()
    {
        $company = factory(Company::class)->create();
        $this
            ->delete(route('company.destroy', $company->id))
            ->assertStatus(302);
    }

20 Dec
6 months ago

adnan483 started a new conversation Sending Email With Mailgun - Undefined Variable

public function send(Request $request,$email)
    {
      $advert = Advert::find($request->adverts);
      $maildata = [
        'advert' => $advert
      ];
      Mail::send('email.reklama',$maildata, function($message){
        $message->to($email, 'User')->subject('Email');
      });
      return redirect()->back();
    }

I have problem with this line $message->to($email, 'User')->subject('Email');, undefined variable $email, I tried $request->email, but it doesn't work too. Is possible to use variable on that place?

24 Nov
7 months ago

adnan483 started a new conversation Filter With Laravel And Ajax

is possible to make filter on this way with laravel and ajax: Ajax code:

function filter_data(){
                $('.filter_data').html('<div id="loading"></div>');
                var minimum_price = $('#hidden_minimum_price').val();
                var maximum_price = $('#hidden_maximum_price').val();
                var brand = get_filter('brand');
                var size = get_filter('size');
                var color = get_filter('color');
                var cat = $('#cat').val();
                var orderby = $('.orderby').val();
                $.ajax({
                        headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        },
                        url: '/products',
                        type: 'get',
                        data: {minimum_price:minimum_price, maximum_price:maximum_price, brand:brand, size:size, orderby:orderby,color:color, cat:cat},
                        success:function(data){
                            $('.filter_data').html(data);
                        }
                });
            }

Controller

public function sviproizvodi(){
       $products = DB::table('products as p')->join('product_attributes as pa','p.id','=','pa.product_id')->select('p.*','pa.size')->where('p.status', 1)->groupBy('p.id');

       if (isset($request->minimum_price) && isset($request->maximum_price)) {
           $products->whereBetween('p.price', [$request->minimum_price, $request->maximum_price]);
       }
       if (isset($request->brand)) {
           $products->whereIn('p.brand_id', $request->brand);
       }
       if (isset($request->cat)) {
           $products->whereIn('p.category_id', $request->cat);
       }
       if (isset($request->orderby)) {
         if ($request->orderby == "standardno") {
           $products->orderBy('p.id','desc');
         }
         if ($request->orderby == "istaknute") {
           $products->orderBy('p.featured','desc');
         }
         if ($request->orderby == "novi") {
           $products->orderBy('p.id','desc');
         }
         if ($request->orderby == "cijena1") {
           $products->orderBy('p.price','asc');
         }
         if ($request->orderby == "cijena2") {
           $products->orderBy('p.price','desc');
         }
         if (isset($request->size)) {
             $products->whereIn('pa.size', $request->size);
         }
         if (isset($request->color)) {
             $products->whereIn('pa.color', $request->color);
         }
       }
      $proizvodi = $products->paginate(15);
       return view('products',compact('proizvodi'));
    }
08 Nov
8 months ago

adnan483 started a new conversation Joining Two Tables

I have this code to left join two tables but problem is I have listed products with same image times as sizes for that product in another table, I need each product only once listed

$products = DB::table('products')->join('product_attributes', 'products.id','=','product_attributes.product_id')->select('products.*', 'product_attributes.*')->where('products.status', 1);
        if (isset($request->minimum_price) && isset($request->maximum_price)) {
            $products->whereBetween('products.price', [$request->minimum_price, $request->maximum_price]);
        }
        if (isset($request->brand)) {
            $products->whereIn('products.brand_id', $request->brand);
        }
        if (isset($request->size)) {
            $products->whereIn('product_attributes.size', $request->size);
        }
        $result = $products->get();

adnan483 left a reply on Write Complex Query With Eloquent

@cronix I tried it like this

$products = DB::table('products')->join('product_attributes', 'products.id','=','product_attributes.product_id')->select('products.*', 'product_attributes.*')->where('products.status', 1);
        if (isset($request->minimum_price) && isset($request->maximum_price)) {
            $products->whereBetween('products.price', [$request->minimum_price, $request->maximum_price]);
        }
        if (isset($request->brand)) {
            $products->whereIn('products.brand_id', $request->brand);
        }
        if (isset($request->size)) {
            $products->whereIn('product_attributes.size', $request->size);
        }
        $result = $products->get();

but problem is I have products as many as sizes in attributes table, and distinct is not working in this case

adnan483 left a reply on Write Complex Query With Eloquent

@cronix I have in another table sizes and colors is possible to add that table in that query to? Same thing like brand but only size and color from product-stock

06 Nov
8 months ago

adnan483 started a new conversation Write Complex Query With Eloquent

Is possible to do this with query builder:


$query = "SELECT * FROM products WHERE status = 1";

some if statement and concat 

$query .= "AND product_price BETWEEN $request->minimum AND $request->maximum";

again some if and

$brand_filter = implode("','",$request->brand);
$query .= "AND product_brand IN('". $brand_filter."')";

adnan483 left a reply on Get All Sizes And Their Count

@tisuchi

I solve it on this way ´´´ $sizes = DB::table('product_attributes')->select(DB::raw('count(*) as totalPerSize, size')) ´´´

Is possible to do this with query builder: ´´´ $query = "SELECT * FROM products WHERE status = 1";

some if statement and concat

$query .= "AND product_price BETWEEN $request->minimum AND $request->maximum";

again some if and

$brand_filter = implode("','",$request->brand); $query .= "AND product_brand IN('". $brand_filter."')";

´´´

adnan483 started a new conversation Get All Sizes And Their Count

Is possible to get all sizes and their count on this way?

$sizes = ProductAttributes::distinct('size')->get();
03 Nov
8 months ago

adnan483 started a new conversation Reading Cookies On Load

I have problem with reading cookies which I have this code in AppService Provider

public function register()
    {
        //
        view()->composer('*', function($view){
            if (empty(Cookie::get('Currency'))) {
              Cookie::queue('Currency', 1, 100000);
              Cookie::queue('CurrencySign', '$',100000);
            }
            $currency = Cookie::get('Currency');
            $sign = Cookie::get('CurrencySign');
            $view->with('valuta',$currency);
            $view->with('sign',$sign);
        });
    }

problem is when I open page first time all values are 0, and after refresh everything works fine, how can I solve this?

09 Oct
9 months ago

adnan483 started a new conversation Too Few Arguments To Function

hi, I have problem with update code:

public function update(Request $request, $id){
        $user = User::find($id);
          $user->name = $request['name'];
          $user->address = $request['address'];
          $user->city = $request['city'];
          $user->state = $request['state'];
          $user->postcode = $request['postcode'];
          $user->mobile = $request['mobile'];
          $user->password = $request['password'];
        $user->update();
        return redirect()->back();
    }

and

<div class="container" style="margin-top:70px;margin-bottom:50px">
                    {!! Form::model($korisnik,['method'=>'PATCH','action'=>['[email protected]',$korisnik->id]]) !!}
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Ime:</label>
                            <div class="col-lg-9 effect1">
                                                            {!! Form::text('name',null,['class'=>'s-text7 w-full p-b-5','placeholder'=>'Unesite ime i prezime...']) !!}
                                                            <span class="effect1-line"></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Adresa:</label>
                            <div class="col-lg-9 effect1">
                              {!! Form::text('address',null,['class'=>'s-text7 w-full p-b-5']) !!}
                                                            <span class="effect1-line"></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Grad:</label>
                            <div class="col-lg-9 effect1">
                              {!! Form::text('city',null,['class'=>'s-text7 w-full p-b-5']) !!}
                                                            <span class="effect1-line"></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Regija:</label>
                            <div class="col-lg-9 effect1">
                                {!! Form::text('state',null,['class'=>'s-text7 w-full p-b-5']) !!}
                                                                <span class="effect1-line"></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Država:</label>
                            <div class="col-lg-9">
                                {!! Form::select('country', ['BIH' => 'Bosna i Hercegovina'], null, ['class'=>'form-control','placeholder' => 'Odaberite državu...']); !!}
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Broj pošte:</label>
                            <div class="col-lg-9 effect1">
                                {!! Form::text('postcode',null,['class'=>'s-text7 w-full p-b-5']) !!}
                                                                <span class="effect1-line"></span>
                            </div>
                        </div>
                                                <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Broj telefona:</label>
                            <div class="col-lg-9 effect1">
                                {!! Form::text('mobile',null,['class'=>'s-text7 w-full p-b-5']) !!}
                                                                <span class="effect1-line"></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Lozinka</label>
                            <div class="col-lg-9 effect1">
                                {!! Form::password('password', ['class' => 's-text7 w-full p-b-5']); !!}
                                                                <span class="effect1-line"></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label">Potvrdi lozinku</label>
                            <div class="col-lg-9 effect1">
                                {!! Form::password('confirm_password', ['class' => 's-text7 w-full p-b-5']); !!}
                                                                <span class="effect1-line"></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-lg-3 col-form-label form-control-label"></label>
                            <div class="col-lg-9">
                                {!! Form::submit('Spremi promjene!',['class'=>'btn btn-primary btn-large pull-right']); !!}
                            </div>
                        </div>
                    {!! Form::close() !!}
    </div>
05 Oct
9 months ago

adnan483 left a reply on Operating With Dates

@Cronix that's it, works perfect :) thank you

adnan483 started a new conversation Operating With Dates

<div class="block2-img wrap-pic-w of-hidden pos-relative {{ ($product->created_at->diffForHumans()<7) ? 'block2-labelnew' : '' }}">

I want to show for one week icon NEW over products. Is it possible with some date function to count days?

19 Aug
10 months ago

adnan483 left a reply on Html Collective Select - Unsupported Operand Types

Combinations from controller doesn't work, but I solve it on this way:

<div>
{!! Form::select('parent_id', [''=>'Glavnakategorija']+App\Category::where(['parent_id'=>0])->pluck('name','id')->all(),null,['class'=>'form-control show-tick']) !!}
</div>

adnan483 left a reply on Html Collective Select - Unsupported Operand Types

It doesn't work, I tried that.

adnan483 started a new conversation Html Collective Select - Unsupported Operand Types

I have problem to fill select from database, here is my view:

  {!! Form::select('parent_id', [''=>'Glavna kategorija']+$categories,null,['class'=>'form-control']) !!}

and controller code:

$categories = Category::where(['parent_id'=>0])->pluck('name','id')->all();
return view('admin.category',compact('categories'));
18 Aug
10 months ago

adnan483 left a reply on ECommerce From Scratch?

I'm ready for that but for beginning I need managing products and orders, because this will be for long long time..

17 Aug
10 months ago

adnan483 left a reply on ECommerce From Scratch?

wow, It's second option, I need half of it for beginning, but I have time until january.

adnan483 left a reply on ECommerce From Scratch?

Yeah it is huge, client want custom shop and want me for long term for that, can you suggest me any migrations for it, because I hate when I make migration,and forms add, edit etc.. and need to add something to cover some option.

adnan483 started a new conversation ECommerce From Scratch?

Hello all, I'm wondering is good to build eCommerce website with Laravel framework? is it enough secured and is possible to add payment with paypal and credit cards? and is there any good database schema to start with?

30 Mar
1 year ago

adnan483 left a reply on Using FPDF In Laravel 5.5?

Yeah of course, the problem is FPDF is built for PHP 5.*, it doen't work in PHP 7, and in some cases it works from web.php(routes) not in controllers(show method).

12 Mar
1 year ago

adnan483 started a new conversation Deleting Photo From Article (pivot Table)

I need help to delete image from pivot table

Here is my view:

<div class="col-md-6">
            @foreach($projekat->slike as $slika)

            <div class="card" style="width: 16rem;">
              <img class="card-img-top" src="{{ $slika->file }}" width="250">
              <div class="card-body">
               <form method="POST" action="/obrisiSliku">
                    <input type="hidden" name="projekatID" value="{{ $projekat->id }}"> 
                    <input type="hidden" name="slikaID" value="{{ $slika->id }}">
                    <input class="btn btn-danger" type="submit" value="Obriši">
               </form>
              </div>
            </div>
 
            @endforeach

Here is my route:

Route::post('/obrisiSliku', function(){
    $projekatID = request('projekatID');
    $slikaID = request('slikaID');
    $projekat = Projekti::find($projekatID);
    $projekat->slike()->detach($slikaID);
    return redirect()->back();
});

I'm getting only: The page has expired due to inactivity.

Please refresh and try again.

07 Mar
1 year ago

adnan483 started a new conversation Requested URL Not Found On Shared Hosting

I uploaded my project on shared hosting, and everything works fine when I put my public folder in public_html folder, but I want to put my project into /public_html/isystem and then every route is not found. I changed path in index.php and it opens login page, but all other are not found?

13 Feb
1 year ago

adnan483 left a reply on Mailgun Not Sending Email

It's view, first parametar of

Mail::send('email',$data,function($message){});

adnan483 started a new conversation Mailgun Not Sending Email

I'm trying to use Mailgun for emails, here is my route code:

Route::post('/kontakt',function(){
    $data = [
        'ime' => request('ime'),
        'email' => request('email'),
        'brojtelefona' => request('brojtelefona'),
        'message' => request('message')
    ];
    Mail::send('email',$data,function($message){
        $message->to('[email protected]','Test')->subject('Kontakt forma ');
    });
});

Here is data from env file:

MAIL_DRIVER=smtp
MAILGUN_DOMAIN=sandbox7fca0a94dd514107aff835**********
MAILGUN_SECRET=key-46ea918f84ec3***************

I'm always getting error:

"htmlspecialchars() expects parameter 1 to be string, object given (View: /Users/code/kgr/resources/views/email.blade.php)

adnan483 left a reply on Use Data From Pivot Table

@bobbybouwmann I'm accessing data with

$projekti->slike

but how to get only first one because I have a few photos for each project?

adnan483 started a new conversation Use Data From Pivot Table

I have data in pivot table

Here is my controller

 public function show($id)
    {
        //
        $projekat = Projekti::find($id);
        return view('project',compact('projekat'));
    }

Here are models:

public function slike() {
    return $this->belongsToMany('App\Slike'); 
    }

and

public function projekti() {
    return $this->belongsToMany('App\Projekti'); 
}

Here is data from table

id  projekti_id slike_id    
1        1                        1 
2        1                        2 
3        1                        3 

Now I want to load them into view page

12 Feb
1 year ago

adnan483 started a new conversation Uploading Multiple Files "Invalid Argument Supplied For Foreach()"

I'm trying to upload multiple photos but have problem with "Invalid argument supplied for foreach()" Here is my controller:

 public function store(Request $request)
    {
        //
        $input = request()->all();
        foreach($request->file('slike') as $file) {
            $name = time() . $file->getClientOriginalName();
            $file->move('projekti', $name);
            $photo = Slike::create(['file'=> $name]);
            $input['slike'] .= $photo->id . ',';
        }
        Projekti::create($input);
    }

View:

            <div class="form-group">
            {!! Form::file('slike[]', ['multiple' => 'multiple']); !!}
            </div>
            <div class="form-group">
            {!! Form::submit('Spremi',['class'=>'btn btn-primary btn-block']) !!}
            </div>

adnan483 started a new conversation Add Multiple Photos To Article

I'm trying to upload a few photos to some article, but have problem with it..

Here is my table:

        $table->increments('id');
            $table->string('naziv')->nullable();
            $table->string('klijent')->nullable();
            $table->string('lokacija')->nullable();
            $table->string('povrsina')->nullable();
            $table->string('godina')->nullable();
            $table->string('vrijednost')->nullable();
            $table->text('opis')->nullable();
            $table->text('kategorija');
            $table->string('slike')->nullable();
            $table->timestamps();

I have pivot table too

       Schema::create('projekti_slike', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('projekti_id');
            $table->integer('slike_id');
            $table->timestamps();
        });

and here is my controller

public function store(Request $request)
    {
        //
        if ($file = $request->file('file')) {
            # code...
            $name = time() . $file->getClientOriginalName();

            $file->move('projekti', $name);

            $photo = Slike::create(['file'=> $name]);

            $input['slike'] = $photo->id;

        }
        Projekti::create($input);
    }

I'm trying to do this using dropzoneJS for uploading pictures

17 Jan
1 year ago

adnan483 started a new conversation Choose Current Year By Java Script

I have year values in select box On top I added on div container onload="myFunction()"

{!! Form::select('godina', $nlg ,null,['class'=>'form-control','id'=>'test'],array('onchange' => 'myFunction()')) !!}

I want to load only data from this year on load and to load old data if user change select box value

<script>
function myFunction() {
  var input, filter, table, tr, td, i,strUser;
  input = document.getElementsById("test");
  strUser = input.options[input.selectedIndex].value;
  filter = strUser.value.toUpperCase();
  table = document.getElementById("myTable");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[10];
    if (td) {
      if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }
  }
}
</script>
14 Jan
1 year ago

adnan483 started a new conversation Is Possible To Use Where() And WhereBetween()

I have query but need to add where() too:

$nalozi = Nalog::whereBetween('rokisporuke',[request('od'),request('do')])->orderBy('rokisporuke', 'ASC')->get();
12 Jan
1 year ago

adnan483 left a reply on Put Data From Database To Chart

@BezhanSalleh thank you for course, I'll check it. I found solution to fill chart but have one more problem, here is my query:

DB::select('SELECT sum(ukupni_dug) AS "ukupno",DAY(created_at) as dan FROM duznicis GROUP BY DAY(created_at) LIMIT 31;');

is possible to add after table name something like WHERE month = current_month because if I add value to 1. January and 1. February, it sum both values, I want to get report for specific month or last 31 day from today?

adnan483 started a new conversation Put Data From Database To Chart

I want to take from database all dates until today or last 15 days and sum of solds for each day and all that put in chart

Route::get('/admin/statistic',function(){
    $montly = DB::table('salles')
    ->select(DB::raw('SUM(total) as total'))
    ->groupBy(DB::raw('DAY(created_at) DESC'));
    return view('admin.statistika.index',compact('montly'));
});

I'm trying to put this inside of this chart can't echo anything from $montly

<script>
  Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#292b2c';
  var ctx = document.getElementById("poslovanje");
var myLineChart = new Chart(ctx, {
  type: 'line',
  data: {
    labels: ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13"],
    datasets: [{
      label: "Sessions",
      lineTension: 0.3,
      backgroundColor: "rgba(2,117,216,0.2)",
      borderColor: "rgba(2,117,216,1)",
      pointRadius: 5,
      pointBackgroundColor: "rgba(2,117,216,1)",
      pointBorderColor: "rgba(255,255,255,0.8)",
      pointHoverRadius: 5,
      pointHoverBackgroundColor: "rgba(2,117,216,1)",
      pointHitRadius: 20,
      pointBorderWidth: 2,
      data: [10000, 30162, 26263, 18394, 18287, 28682, 31274, 33259, 25849, 24159, 32651, 31984, 38451],
    }],
  },
  options: {
    scales: {
      xAxes: [{
        time: {
          unit: 'date'
        },
        gridLines: {
          display: false
        },
        ticks: {
          maxTicksLimit: 7
        }
      }],
      yAxes: [{
        ticks: {
          min: 0,
          max: 40000,
          maxTicksLimit: 5
        },
        gridLines: {
          color: "rgba(0, 0, 0, .125)",
        }
      }],
    },
    legend: {
      display: false
    }
  }
});
</script>

adnan483 left a reply on Upload Validation Issue (Error Communication)

You can try making new request

php artisan make:request UploadRequest

Here is Upload Request file:

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UploadRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'avatar.*' => 'required|mimes:jpg,jpeg,png,bmp|max:800',
            'avatar.*.required' => 'Please upload an image',
            'avatar.*.mimes' => 'Only jpeg,png and bmp images are allowed',
            'avatar.*.max' => 'Sorry! Maximum allowed size for an image is 20MB'
        ];
    }
}

and then:

public function uploadAvatar(UploadRequest $request){

        if($request->hasFile('avatar')){
            $user = Auth::user();
            $input_data = $request->all();
            $image = $request->file('avatar');
            $filename = time() . '.' . $image->getClientOriginalExtension();
            $location = public_path('uploads/avatars/'. $filename);
            Image::make($image)->resize(300,300)->save($location);
            $user->avatar = $filename;
            $user->save();  
        }

        return redirect()
            ->route('profile.editavatar')
            ->with('info', 'Your avatar has been uploaded.');
    }

don't forget to import Request on top of controller:

use App\Http\Requests\UploadRequest;
11 Jan
1 year ago

adnan483 left a reply on Backup Doesn't Work

@BezhanSalleh I finally insert it into my project, but how to backup only database, I tried this but doesn't work?

 \Artisan::call('backup:run --only-db');

adnan483 left a reply on Backup Doesn't Work

@BezhanSalleh Thank you for advice, but I solve this problem deleting file services.php from bootstrap/cache, can you suggess me any other working backup?

10 Jan
1 year ago

adnan483 left a reply on Backup Doesn't Work

@Snapey Laravel Framework 5.4.36

adnan483 left a reply on Backup Doesn't Work

of course, @BezhanSalleh I did composer update, composer dump-autoload, created new 5.4. project and copy resources, public folder, and app folder and again same problem

adnan483 left a reply on Backup Doesn't Work

No, I'm still on 5.6, this is after I remove backup from composer

adnan483 left a reply on Backup Doesn't Work

@Snapey I did that and just have this:

(1/1) FatalErrorException syntax error, unexpected ':', expecting ';' or '{' in Inflector.php (line 265)

adnan483 left a reply on Backup Doesn't Work

@Snapey I tried spatie backup right now and now have bigger problem, can open application, just see this Class 'Backup\BackupServiceProvider' not found, I remove it from vendor and still same problem

08 Jan
1 year ago

adnan483 left a reply on Backup Doesn't Work

@Snapey I tried that but still same message: Database 'test' cannot be dumped'

07 Jan
1 year ago

adnan483 left a reply on Backup Doesn't Work

@Yama Everything is ok with .env file, I'm using it normally for other things, but still not working.

adnan483 left a reply on Backup Doesn't Work

@Yama The same problem again, it shows database backed up but it's not, I tried as return \Artisan::output() and got this 'Database 'test' cannot be dumped'

adnan483 left a reply on Backup Doesn't Work

@Yama Nothing, there is no error. when I use dd() it shows only 0.

adnan483 started a new conversation Backup Doesn't Work

I'm using paulvl/backup backup package, when I try to use it from Terminal:

php artisan backup:mysql-dump

it works perfect and store it inside of /storage/app/backups but when try to use it from controller

public function store(){
        Artisan::call('backup:mysql-dump');
    }

it doesn't work?