gidaban79

Experience

6,540

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 51 Lessons Completed
  • 0 Favorites

8th September, 2018

gidaban79 left a reply on Validate Rules When You Want To Edit Post? • 1 week ago

How about poster ?

i tried "sometimes|image" even is empty i got error poster should be an image file

gidaban79 started a new conversation Validate Rules When You Want To Edit Post? • 1 week ago

Hello guys,

at the beginning i would like to as about best way for validate date before put to database but only when i want to edit post.

i have fields 'title' 'body' 'poster'

$this->validate($request->all(),
[
        'title' => 'required|unique:blogs|max:190',
                'description' => 'required',
                'poster' => 'required|image|max:51200'
] );

that is simple validation when i add post

how should looks validation rules in update post ?

7th September, 2018

gidaban79 left a reply on How To Turn Off Auto Login Users ? In Laravel 5.7 • 1 week ago

@bestmomo

Yes @OriOn explain how to overwrite in REGISTER function, not in login process.

Thanks :)

gidaban79 left a reply on How To Turn Off Auto Login Users ? In Laravel 5.7 • 1 week ago

Hello guys,

i really have to turn off auto login after register or verify email.

User should login by him self.

Its is my question.

gidaban79 left a reply on How To Turn Off Auto Login Users ? In Laravel 5.7 • 1 week ago

@shez1983 @Cronix Where you can find remember me in register form ?

gidaban79 started a new conversation How To Turn Off Auto Login Users ? In Laravel 5.7 • 1 week ago

Hello guys,

i really have to turn off auto login after register or verify email.

User should login by him self.

25th August, 2018

gidaban79 started a new conversation ACL Including Access For Controllers • 3 weeks ago

Hello guys :)

Someone tried to make a ACL based on database?

What i mean, in ZEND framework you can build something like that. In database are stored information :

Controller, action, access level;

for example in one controller users have to access for show action but not for create or store action.

14th August, 2018

gidaban79 left a reply on How To Use Package From Vendor Directory • 1 month ago

yeah that is just html but for example how to link css or js files?

gidaban79 started a new conversation How To Use Package From Vendor Directory • 1 month ago

hello guys.

i just add package to my project "almasaeed2010/adminlte" im sure everyone know what it is :)

and now how i can use it in my project?

i have to move all files form "dist" directory to public directory ?

8th July, 2018

gidaban79 left a reply on How To Return Generated Password After Create New User. • 2 months ago

@Cronix Yeah i know that, but i have signed by them what they want, and they understand it. Even is really not safe.

gidaban79 left a reply on How To Return Generated Password After Create New User. • 2 months ago

that will be just really rare time, my customer want to sent password via email.

@Cronix Good solutions for future, thanks

gidaban79 started a new conversation How To Return Generated Password After Create New User. • 2 months ago

Hello guys,

Hope are you well?

What i do?

In my admin panel i want to add new users. It works fine, but also i want to send email with login "[email protected]" user with automatically generated password. But after insert all data do database password is already hashed.

my function:

protected function createUser(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt(str_random(10))
        ]);
    }

and function for store data:

    public function store(Request $request)
    {
        $this->validator($request->all())->validate();

        $user = $this->createUser($request->all());
        Mail::to($user->email)->send(new adminAddNewUser($user));
    }

All data are pass after insert to database, is any method for get a unhashed password? Just for remind account is created by admin.

15th June, 2018

gidaban79 left a reply on Dropzone.js How To Hide Progress Bar Of Uploaded Files? • 3 months ago

i'm trying upload images to gallery.

i don't need a total progress bar but for each files. if files will be upload successfully progress bar should be hidden. After upload files on server i have my files, but still is active a progress bar of file which has been uploaded.

gidaban79 left a reply on Dropzone.js How To Hide Progress Bar Of Uploaded Files? • 3 months ago

I really don't have problems with total upload progress bar, but with each file.

gidaban79 left a reply on Dropzone.js How To Hide Progress Bar Of Uploaded Files? • 3 months ago

i added

        myDropzone.on("queuecomplete", function (progress) {
            document.querySelector("#total-progress").style.opacity = "0";
            console.log(1);
        });

and yes after upload in console i see '1'.

gidaban79 started a new conversation Dropzone.js How To Hide Progress Bar Of Uploaded Files? • 3 months ago

Hello guys,

on beginning i want to say this script is really awesome :)

i want to integrate with Laravel, working fine, function return true or error, but if my function return true progress bar of uploaded files is still visible.

var previewNode = document.querySelector("#template");
        previewNode.id = "";
        var previewTemplate = previewNode.parentNode.innerHTML;
        previewNode.parentNode.removeChild(previewNode);

        var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
            url: "/admins/gallery/upload", // Set the url
            headers: {
                'x-csrf-token': document.querySelectorAll('meta[name=csrf-token]')[0].getAttributeNode('content').value,
            },
            thumbnailWidth: 220,
            parallelUploads: 20,
            previewTemplate: previewTemplate,
            autoQueue: false,
            previewsContainer: "#previews",
            clickable: ".fileinput-button"
        });

        myDropzone.on("addedfile", function(file) {
            // Hookup the start button
            file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file); };
        });

        myDropzone.on("totaluploadprogress", function(progress) {
            document.querySelector("#total-progress .progress-bar").style.width = progress + "%";
        });

        myDropzone.on("sending", function(file) {
            document.querySelector("#total-progress").style.opacity = "1";
            file.previewElement.querySelector(".start").setAttribute("disabled", "disabled");
        });

        myDropzone.on("queuecomplete", function(progress) {
            document.querySelector("#total-progress").style.opacity = "0";
        });

        document.querySelector("#actions .start").onclick = function() {
            myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED));
        };
        document.querySelector("#actions .cancel").onclick = function() {
            myDropzone.removeAllFiles(true);
        };

php function

        $image = $request->file('file');
        $imageName = md5(uniqid(rand(), true) . $image) . '.' . $image->getClientOriginalExtension();
        $upload_success = $image->move(public_path('images'),$imageName);

        if ($upload_success) {
            return response()->json(true, 200);
        }
        // Else, return error 400
        else {
            return response()->json('error', 400);
        }

template html

            <div id="actions" class="row">

                <div class="col-md-7">
                    <!-- The fileinput-button span is used to style the file input field as button -->
                    <span class="btn btn-flat btn-success fileinput-button dz-clickable">
                <i class="glyphicon glyphicon-plus"></i>
                <span>Add files...</span>
                        </span>
                    <button type="submit" class="btn btn-flat btn-primary start">
                        <i class="glyphicon glyphicon-upload"></i>
                        <span>Start upload</span>
                    </button>
                    <button type="reset" class="btn btn-flat btn-warning cancel">
                        <i class="glyphicon glyphicon-ban-circle"></i>
                        <span>Cancel upload</span>
                    </button>
                </div>

                <div class="col-lg-5">
                   <span class="fileupload-process">
          <div id="total-progress" class="progress progress-striped active" role="progressbar" aria-valuemin="0"
               aria-valuemax="100" aria-valuenow="0">
                        <div class="progress-bar progress-bar-success" style="width:0%;"
                             data-dz-uploadprogress=""></div>
                    </div>
                    </span>
                </div>
                <div class="clearfix">&nbsp;</div>
            </div>
            <div class="row" class="files" id="previews">

                <div id="template" class="file-row col-md-3">
                    <!-- This is used as the file preview template -->
                    <div>
                        <div class="preview"><img data-dz-thumbnail class="img-thumbnail"/></div>
                    </div>
                    <div>
                        <strong class="error text-danger" data-dz-errormessage></strong>
                    </div>
                    <div>
                        <p class="size" data-dz-size></p>
                        <div class="progress progress-striped active" role="progressbar" aria-valuemin="0"
                             aria-valuemax="100" aria-valuenow="0">
                            <div class="progress-bar progress-bar-success" style="width:0%;"
                                 data-dz-uploadprogress></div>
                        </div>
                    </div>
                    <div class="text-center">
                        <button class="btn btn-flat btn-sm btn-primary start">
                            <i class="glyphicon glyphicon-upload"></i>
                            <span>Start</span>
                        </button>
                        <button data-dz-remove class="btn btn-flat btn-sm btn-warning cancel">
                            <i class="glyphicon glyphicon-ban-circle"></i>
                            <span>Cancel</span>
                        </button>
                        <button data-dz-remove class="btn btn-flat btn-sm btn-danger delete">
                            <i class="glyphicon glyphicon-trash"></i>
                            <span>Delete</span>
                        </button>
                    </div>
                </div>

            </div>

9th June, 2018

gidaban79 started a new conversation Login And Register Forms On One Page (one View File) • 3 months ago

Hello guys.

Someone trying something similar?

2 forms in one view?

How to display errors depend from which form has been completed?

3rd June, 2018

gidaban79 left a reply on Comment System With Jquery Effects ? • 3 months ago

Okay what i have for now.

$(function () {
    toastr.options = {
        closeButton: true,
        progressBar: true,
        showMethod: 'slideDown',
        timeOut: 2500
    };
    "use strict";
    $('[data-action="add-comment"]').on('click', function () {
        var commentText = $('textarea#comment');
        commentText.css('border', '1px solid rgba(0,0,0,.15)');
        var commentMin = 4;
        var parent_id = $('#parent_id').val();
        var commentList = $('.comment-list');
        var commentTemplate = '<div class="media mb-4"><img src="{avatar}" class="d-flex mr-3 rounded-circle" alt="{user}"><div class="media-body"><p class="mt-0"><i class="fa fa-user"></i> {user}, <i class="fa fa-calendar"></i> {date}</p><small>{comment}</small></div></div>';
        $(':input[type="submit"]').prop('disabled', true);
        if (commentText.val() == '') {
            toastr.error('Comment field can\'t be empty!');
            setTimeout(function () {
                $(':input[type="submit"]').prop('disabled', false);
            }, 2650);

        } else if (commentText.val().length <= commentMin) {
            toastr.error('Comment field must have more than ' + commentMin + ' characters!');
            setTimeout(function () {
                $(':input[type="submit"]').prop('disabled', false);
            }, 2650);
        } else {
            $.ajax({
                url: '/user/comments/',
                type: 'POST',
                data: {
                    _token: $('meta[name="csrf-token"]').attr('content'),
                    _method: 'POST',
                    comment: commentText.val(),
                    parent_id: parent_id
                },
                success: function (response) {
                    if (response.error) {
                        commentText.css('border', 'solid 1px #bd362f');
                        toastr.error(response.message);
                        setTimeout(function () {
                            $(':input[type="submit"]').prop('disabled', false);
                        }, 2650);
                    } else {
                        var comment = commentTemplate;
                        comment = comment.replace(/\{avatar\}/g, response.avatar);
                        comment = comment.replace(/\{user\}/g, response.user);
                        comment = comment.replace(/\{comment\}/g, response.comment);
                        comment = comment.replace(/\{date\}/g, response.date);
                        toastr.success(response.message);
                        commentText.val('');
                        commentList.prepend(comment).slideDown(2000);
                        setTimeout(function () {
                            $(':input[type="submit"]').prop('disabled', false);
                        }, 2650);
                    }
                }
            });
        }
        return false;
    });

});

i add .slideDown(2000) effect but still my last comment is showed immediately after hit button.

gidaban79 started a new conversation Comment System With Jquery Effects ? • 3 months ago

Hello Guys,

i'm looking for some inspiration to my project. I want to add comments under blog post. i wondering if somebody do something similar?

After add comment, this entry will scroll down under textarea field?

1st June, 2018

gidaban79 started a new conversation Laravel Collective Forms & HTML HTML::file() • 3 months ago

Hello Guys another question.

Is any method for fill old value of file field after fail validate another fields ?

Form::file();

gidaban79 left a reply on Automatic Addition Of New Tags • 3 months ago

Thanks Guys, but both are only for one tag. Then make loop for all tags before adding post ?

gidaban79 started a new conversation Automatic Addition Of New Tags • 3 months ago

Hello Guys,

Maybe someone tried to do same thing ?

I using in my project selec2 js plugin for tags, what if user want to add new tag which is not on list? Is any way for add it?

11th March, 2018

gidaban79 left a reply on Default Redirect After Login In Laravel 5.5 • 6 months ago

In my opinion always overwrite methods, what if you will update version of framework?

22nd February, 2018

gidaban79 started a new conversation CSS Skewed / Razor-Blade Div Shape • 6 months ago

Hello guys,

I need some help with css, i have to make 2 divs skewed one of them - left with image background, and right with gradient as background;

Somebody trying to do something like that?

2nd January, 2018

gidaban79 started a new conversation Formatting Mailables Templates. • 8 months ago

Hello guys,

Happy new year :)

And now i will post my question.

Someone can tell me how i can formatting email templates?

what i know '#' is like h1, do you know guys about more?

I'm trying to use github formatting but without results.

Any ideas ?

Many thanks

16th October, 2017

gidaban79 left a reply on Bootstrap Switch And DataTable • 11 months ago

If somebody looking for solution

$('#posts').DataTable({
                "order": [[1, "asc"]],
                "aoColumns": [
                    null,
                    null,
                    null,
                    {"bSortable": false, "bSearchable": false},
                    null, {"bSortable": false, "bSearchable": false},
                    null,
                    null,
                    {"bSortable": false, "bSearchable": false}
                ],
                "fnDrawCallback": function() {
                    $('.grid-switch-released').bootstrapSwitch({
                        size: 'small',
                        onText: 'YES',
                        offText: 'NO',
                        onColor: 'primary',
                        offColor: 'default',
                        onSwitchChange: function (event, state) {

                            $(this).val(state ? 'on' : 'off');

                            var pk = $(this).data('key');
                            var value = $(this).val();
                            var publishDate = $('[data-published-id="' + pk + '"]');
                            var featureDate = $('[data-featured-id="' + pk + '"]');

                            var action = $(this).data('action');
                            $.ajax({
                                url: "/admins/posts/" + pk,
                                type: "POST",
                                data: {
                                    released: value,
                                    action: action,
                                    _token: '{{csrf_token()}}',
                                    _method: 'PUT'
                                },
                                success: function (data) {
                                    if (data.action == "publish") {
                                        publishDate.html(data.date);
                                    } else {
                                        featureDate.html(data.date);
                                    }
                                    toastr.success(data.message);
                                }
                            });
                        }
                    });
                }
            });

10th October, 2017

gidaban79 started a new conversation Bootstrap Switch And DataTable • 11 months ago

Hello all,

In my Admin Panel i use 2 plugins for display data from Database:

1 - Bootstrap Switch 2 - DataTable

So far i don't have problems with Datatable and display it, but i want to add one column with swith button for change status of featured post, script working only on first page. For others page is just checkbox.

My code is below.

''' $('#posts').DataTable({ 'paging': true, 'lengthChange': false, 'searching': true, 'ordering': true, 'info': true, 'autoWidth': true }); $('.grid-switch-released').bootstrapSwitch({ size:'mini', onText: 'YES', offText: 'NO', onColor: 'primary', offColor: 'default', onSwitchChange: function(event, state){

                $(this).val(state ? 'on' : 'off');

                var pk = $(this).data('key');
                var value = $(this).val();

                $.ajax({
                    url: "/admin/posts/" + pk,
                    type: "POST",
                    data: {
                        released: value,
                        _token: '{{csrf_token()}}',
                        _method: 'PUT'
                    },
                    success: function (data) {
                        toastr.success(data.message);
                    }
                });
            }
        });

'''

gidaban79 left a reply on How To Do PHPUni Tests In CLI Script? • 11 months ago

Thanks :)

5th October, 2017

gidaban79 started a new conversation How To Do PHPUni Tests In CLI Script? • 11 months ago

I know subject is not with Laravel, but maybe someone can expain me how to do PHPUnit test?

I have already script in PHP i know it works, but how to write test for it ?

it's simple script to generate multiplication table. Thing is script generates and display data.

1st October, 2017

gidaban79 left a reply on Default Redirect After Login In Laravel 5.5 • 11 months ago

@AlbertMulaki

Thanks Works well

gidaban79 left a reply on Default Redirect After Login In Laravel 5.5 • 11 months ago

'''| | GET|HEAD | / | app.index | App\Http\Controllers\[email protected] | web |'''

gidaban79 left a reply on Default Redirect After Login In Laravel 5.5 • 11 months ago

'''Route::get('/', ['uses'=>'[email protected]','as'=>'app.index']);'''

This redirection is correct, but if you will enter again on login form i got redirection to "/home"

gidaban79 left a reply on Default Redirect After Login In Laravel 5.5 • 11 months ago

Yes i did it

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Auth;
class LoginController 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 = '/';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
    protected function redirectTo()
    {
        return redirect('/');
    }
    public function login(Request $request){
        $this->validate($request,[
            'email'=>'required|email',
            'password'=>'required'
        ]);
        if(auth()->attempt(['email'=>$request->email,'password'=>$request->password])){

            if(auth()->user()->confirmed==0){
                Auth::logout();
                return back()->with('warning', 'Your account has not yet been activated. Please check Your email');
            }
            return redirect(route('app.index'));
        }else {
            return back()->with('warning', 'Address email or/and password are incorrect.');
        }
    }
}

gidaban79 started a new conversation Default Redirect After Login In Laravel 5.5 • 11 months ago

Hi,

On beginning i will answer yes i have changed "$redirectTo" for other route after login, register. But when i click again on login link i'm redirecting on "/home". thing is i have to make a route in web.php file because without it i got exception.

Any ideas how i can change it?

16th June, 2017

gidaban79 left a reply on Carbon And Conversion Date • 1 year ago

Sorry for late reply i was busy

input form

<input type="text" name="featured_to" />

just example.

And now user picking date by "Bootstrap Datepicker", after it field is filled "16/06/2017" -"dd/mm/yyyy"

After send form i catch it "$request->published_at"n still is only date, next i want to use "Carbon" for convert it Carbon::createFromFormat('d/m/Y H:i:s',$request->published_at)->toDateTimeString() after it i getting date in correct format, time not date, time is equal to time send of form, but i need date with time in midnight. 2017-06-16 00:00:00

29th May, 2017

gidaban79 started a new conversation Carbon And Conversion Date • 1 year ago

Hello all,

I hope You are well :)

in my controller i have code for store informations from input, is date in format d/m/Y example 29/05/2017

and now i use code:

$post->featured_to = $request->featured ? Carbon::createFromFormat('d/m/Y', $request->featured_to)->toDateTimeString() : NULL;

Date is convert, but i have to convert date until midnight like '2017-05-31 00:00:00' but date is converted until hour what time i do convert,

Any ideas how to fix it?

1st April, 2017

gidaban79 left a reply on Store Comments In DB • 1 year ago

Any ideas ?

or make manually table for each module ?

30th March, 2017

gidaban79 left a reply on Store Comments In DB • 1 year ago

What i have:

CommentModule.php

 public function comments(){
        return $this->hasMany(Comment::class,'module_id');
    }

Comment.php

public function module(){
        return $this->belongsTo(CommentModule::class);
    }

Map.php

 public function comments(){
        return $this->hasMany(Comment::class,'parent_id');
    }

Controller

$module = new CommentModule();
$module->comments()->where('parent_id',1)->get();

29th March, 2017

gidaban79 left a reply on Store Comments In DB • 1 year ago

but what if i will add more "modules" and i want to add comments ? Every time i have add new column ?

i thing best way is like now is.

gidaban79 left a reply on Store Comments In DB • 1 year ago

module_id -> is id of parent module, i want store all comments in one table. Then i have to store in table for with one module is comment, for example:

id:10;
user_id:15 -> who add comment;
module_id:1 -> is blog. module_id:2 is gallery
parent_id:45 -> is number id of post number

gidaban79 left a reply on Store Comments In DB • 1 year ago

    public function comments(){
        return $this->hasMany(Comment::class,'parent_id');
    }

Example of function for getting data, Right ? but how pass module id?

in DB i have stored:

id,
user_id, => id of user
module_id, => and now how to pass it ?
parent_id, => id of parent id post or gallery
body,
and timestamps 

gidaban79 started a new conversation Store Comments In DB • 1 year ago

Hello Everyone :)

Request:

Store all comments in one table.

Solution:

Design table:

   ``` $table->increments('id');
        $table->integer('user_id')->unsigned();
        $table->integer('module_id')->unsigned();
        $table->integer('parent_id')->insignrd();
        $table->text('body');
        $table->timestamps();```

easy, but now to use eloquents to getting data from table? if "blog" is module "1", "gallery" is module "2"?

Numbers of modules can change ?

Any ideas ?

Many Thanks.

27th February, 2017

gidaban79 left a reply on How To Design Database For Website With Events • 1 year ago

@Snapey

Thanks,

Is not a football events, it will be for concerts, picnics.

Just i have problem how to store it most of usable in database?

Single event with single date is easy, but what if this events is in every Friday of Summer ? Loop all possible dates and save in different table? or save in same table with single event ?

How will be better in future for searching, displaying, listing?

26th February, 2017

gidaban79 left a reply on How To Design Database For Website With Events • 1 year ago

@jlrdw yes events site with cycle events.

juts thing is how will be best way for store dates in database. If one Event can be in every Friday of March ?

if you dont have a strictly dates,

event date 1/03/2017 - 01/04/2017 - but only in Fridays ?

gidaban79 left a reply on How To Design Database For Website With Events • 1 year ago

@lars6 i mean tables in database.

gidaban79 started a new conversation How To Design Database For Website With Events • 1 year ago

Hello guy,

Anybody have experience with design database for it ?

to be honest i dont know how to proper design it for dates.

what i need is events in range of dates, between two dates, for example this event is in march but only in Tuesday and Thursday every week?

Thanks for all suggestion :)

5th January, 2017

gidaban79 started a new conversation Prefer Directory For Storage Images Of Galleries • 1 year ago

Hello and Happy new Year:)

Could please somebody help me with choice of best storage path for images? What is best way or best practice? Use a public path "publuc/images" or storage path of application?

Thanks for all help

Regards Tomek

Edit Your Profile
Update

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