adnan483

Experience

770

0 Best Reply Awards

  • Member Since 1 Month Ago
  • 0 Lessons Completed
  • 0 Favorites

17th January, 2018

adnan483 started a new conversation Choose Current Year By Java Script • 4 days ago

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>

14th January, 2018

adnan483 started a new conversation Is Possible To Use Where() And WhereBetween() • 1 week ago

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

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

12th January, 2018

adnan483 left a reply on Put Data From Database To Chart • 1 week ago

@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 • 1 week ago

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) • 1 week ago

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;

11th January, 2018

adnan483 left a reply on Backup Doesn't Work • 1 week ago

@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 • 1 week ago

@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?

10th January, 2018

adnan483 left a reply on Backup Doesn't Work • 1 week ago

@Snapey Laravel Framework 5.4.36

adnan483 left a reply on Backup Doesn't Work • 1 week ago

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 • 1 week ago

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

adnan483 left a reply on Backup Doesn't Work • 1 week ago

@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 • 1 week ago

@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

8th January, 2018

adnan483 left a reply on Backup Doesn't Work • 1 week ago

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

7th January, 2018

adnan483 left a reply on Backup Doesn't Work • 2 weeks ago

@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 • 2 weeks ago

@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 • 2 weeks ago

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

adnan483 started a new conversation Backup Doesn't Work • 2 weeks ago

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?

6th January, 2018

adnan483 left a reply on Download File • 2 weeks ago

My code doesn't work, I'm asking for help :) I'm getting error, file not found.

adnan483 started a new conversation Download File • 2 weeks ago

How to download file:

@foreach($cjenovnici as $cjenovnik)
    <tr>
        <td>{{$cjenovnik->file}}</td>
        <td><a href="{{response()->download(public_path() . $cjenovnik->file)}}" download class="btn btn-primary">Preuzmi</a></td>
    </tr>
@endforeach 

4th January, 2018

adnan483 started a new conversation Query Builder • 2 weeks ago

How to make this query with QueryBuilder or what?

SELECT duznici_2018.*,sum(rate_2018.rata) as ukupno FROM duznici_2018 LEFT JOIN rate_2018 ON duznici_2018.duznikID=rate_2018.duznikID  GROUP BY duznikID DESC

2nd January, 2018

adnan483 left a reply on Can't Access Value From Model • 2 weeks ago

Thank you, I changed that kupac to something else and now it works normally :)

adnan483 started a new conversation Can't Access Value From Model • 2 weeks ago

Hi, I have problem to access value from model:

Here is my model code :

class Reklamacija extends Model
{
    protected $fillable = ['user_id','nalog_id','kupac_id','mjesto','kontakt','stolarijauradjena','kvar','utrosenimaterijal','reklamacijaodradjena','oddo','radsat','cijenaposatu','iznospopravka','firmasnosi','serviser1','serviser2','napomena','kupac','reklamacijuzavrsio','zavrsena','godina'];
    //
    public function user(){
        return $this->belongsTo('App\User');
    }
    public function kupac(){
        return $this->belongsTo('App\Kupac');
    }

Here is my migration code:

Schema::create('reklamacijas', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id');
            $table->integer('nalog_id');
            $table->integer('kupac_id');
            $table->text('mjesto');
            $table->text('kontakt');
            $table->string('stolarijauradjena');
            $table->text('kvar');
            $table->text('utrosenimaterijal')->nullable();
            $table->date('reklamacijaodradjena')->nullable();
            $table->string('oddo')->nullable();
            $table->string('radsat')->nullable();
            $table->float('cijenaposatu')->nullable();
            $table->float('iznospopravka')->nullable();
            $table->float('firmasnosi')->nullable();
            $table->string('serviser1')->nullable();
            $table->string('serviser2')->nullable();
            $table->text('napomena')->nullable();
            $table->string('kupac')->nullable();
            $table->string('reklamacijuzavrsio')->nullable();
            $table->boolean('zavrsena')->default(0);
            $table->string('godina');
            $table->timestamps();
        });

Here is my Controller code:

public function index(){
        $nezavrsene = Reklamacija::where('zavrsena',0)->get();
        $zavrsene = Reklamacija::where('zavrsena',1)->get();
        return view('reklamacije.index', compact('nezavrsene','zavrsene'));
    }

Both of these $nezavrsene and $zavrsene need value from kupacs table like: $nezavrsene->kupac->imeprezime but every time I get error Trying to get propery of non-object??

1st January, 2018

adnan483 left a reply on Trying To Get Property Of Non-object • 2 weeks ago

thank you a lottt :)

adnan483 started a new conversation Trying To Get Property Of Non-object • 2 weeks ago

I have problem with pulling data from DB, here is my code?

class ReklamacijaController extends Controller
{
    //
    public function index(){
        $nezavrsene = Reklamacija::where('zavrsena',0)->get();
        return view('reklamacije.index', compact('nezavrsene'));
    }
}

and

<div class="col-md-12">
                    @if($nezavrsene)
                    <table class="table table-hover">
                    <tr>
                        <th>Broj Rek.</th>
                        <th>Br.Naloga</th>
                        <th>Kupac</th>
                        <th>Lokacija</th>
                        <th>Kontakt</th>
                        <th>Kvar</th>
                        <th>Rek.Napravio</th>
                        <th>Kreirano</th>
                        <th>Kupac čeka</th>
                        <th>Završi</th>
                        <th>Pregled</th>
                    </tr>
                    
                    @foreach ($nezavrsene as $nezavrsena)
                    
                    <tr>
                        <td>{{ $nezavrsena->id }}</td>
                        <td>{{ $nezavrsena->nalog_id }}</td>
                        <td>{{ $nezavrsena->kupac->imeprezime }}</td>
                        <td>{{ $nezavrsena->lokacija }}</td>
                        <td>{{ $nezavrsena->kontakt }}</td>
                        <td>{{ $nezavrsena->kvar }}</td>
                        <td>{{ $nezavrsena->user->name }}</td>
                        <td>{{ $nezavrsena->created_at->format('d.m.Y') }}</td>
                        <td></td>
                    </tr>

                    @endforeach
                    @endif

31st December, 2017

adnan483 started a new conversation Using FPDF In Laravel 5.5? • 3 weeks ago

Hi, I'm trying to use FPDF in my project, I use setasign/fpdf from Git, but every time when I try to open it, it shows tons of unknown data.

Here is my code:

$pdf = new \setasign\Fpdi\Fpdi(); $pdf->AddPage(); $pdf->setSourceFile('dokumenti/garancija.pdf'); $tplIdx = $pdf->importPage(1); // use the imported page and place it at position 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 5, 5, 205);

// now write some text above the imported page $pdf->SetFont('Times'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(25, 75); $pdf->Write(0, 'Test'); $pdf->SetXY(25, 80); $pdf->Write(0, 'Test'); $pdf->SetXY(19, 55); $pdf->Write(0, 'Test'); $pdf->Output();

28th December, 2017

adnan483 started a new conversation If Exist Take Id If Not Create New Client • 3 weeks ago

Hi, I'm looking solution for my problem, I need to get clients from database while typing(to pick up right one), and if client doesn't exist must create new one, if exist only take his user id and put it in order.

21st December, 2017

adnan483 left a reply on Create Tables And Migrate By Button? • 1 month ago

I made application for one company and they have a lot data like working order, complaints, etc.. and they want to start with new table every new year (in 2018 new table for working order and keep old data in working_orders_2017), I did all that with PHP but is possible to do that by Laravel?

adnan483 started a new conversation Create Tables And Migrate By Button? • 1 month ago

I have project in PHP and want to move it to Laravel and before I start I want to know is possible to create tables for next year by one button click?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.