fastxpert

Experience

790

0 Best Reply Awards

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

19th April, 2018

fastxpert left a reply on Always Share Some Data From Controller To View Composer? • 6 months ago

@Snapey if I need that in more partials etc... it's stupid to make a middleware for that?

18th April, 2018

fastxpert left a reply on Always Share Some Data From Controller To View Composer? • 6 months ago

I need there exactly user id for a other scope, will try it with request...

fastxpert started a new conversation Always Share Some Data From Controller To View Composer? • 6 months ago

I want to share some data always from controller to view composer, at the moment I do that in constructor. But now I need active user and this is not possible in constructor.

Example:

public function __construct(Request $request) {
       view->share('foo', 'Test');
}

Is there any other way to share this data without to put the code directly in constructor? The shared data is in controller because I need it in other controllers and in view composer to decrease mysql requests.

9th March, 2018

fastxpert started a new conversation Laravel 5.5 ->groupBy('created_at') Error? • 7 months ago

I want to group my data by date and need to use created_at date. But there I get permanently this error:

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'laravelapp.items.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select * from `items` group by DATE_FORMAT(created_at, '%Y-%m-%d'))

My method is:

public function scopeUserArchive($query)
    {
        return $query->select('*')
            ->groupBy(DB::raw("DATE_FORMAT(created_at, '%Y-%m-%d')"));
    }

How can I fix that to get grouped data?

5th March, 2018

fastxpert left a reply on Override A Value By "$request->all()"? • 7 months ago

@m-rk @Snapey thanks people :), I search 2 hours for a solution

fastxpert started a new conversation Override A Value By "$request->all()"? • 7 months ago

I added to the user table a field "avatar", it's binary type and want to set avatar name on save.

$user->fill($request->all());
$user->gender($avatar_name);
$user->save();

I get there the error:

BadMethodCallException
Call to undefined method Illuminate\Database\Query\Builder::gender()
vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php

I'm not sure how to override the field avatar?

I tried also with $user->fill($request->except(['avatar'])); but this don't works.

fastxpert started a new conversation Storage (storage/app) Folder Permissions? • 7 months ago

I have ubuntu server and can upload to "storage/app" only if my folder has 7777 permissions, but this is not secure, right? With 775 and 755 is the same issue, cannot upload... Which permission or setup is here needed to be on the right way for uploads & security?

8th December, 2017

fastxpert left a reply on VueJS Method Result To HTML Select Box? • 10 months ago

Sorry for so big topic, in mounted() is my solution:

mounted() {
   this. getTasks();
},

fastxpert started a new conversation VueJS Method Result To HTML Select Box? • 10 months ago

I have a VueJS component, now I'm getting from JSON response which I want to export into a HTML select box.

The VueJS code is:

<script>
    export default {
        data() {
            return {
                taskList: [],
            }
        },
        mounted() {
        },
        methods: {
            syncNow()
            {
                // other method...
            },
            getTasks()
            {
                axios.get('/api/v1/tasklist').then(response => {
                    this.taskList = this.data.taskList;
                });
            }
        }
    }
</script>

The HTML should be like this:

<select v-model="???">
    <option v-for="task in taskList">{{ task.title }}</option>
</select>

How can I export this response into a selectbox, I know how to work with v-for, but I don't know exactly how to initialize this data in HTML (with v-bind, or something like that)?

30th November, 2017

fastxpert started a new conversation Let's Encrypt For Domain And Subdomain In Same App? • 10 months ago

I have my laravel app runing on a digital ocean instance. I use there Let's Encrypt to have secure connection. Now I want in the same laravel app to make a new part for subdomain like: time.myapp.com.

My question is, can I use Let's Encrypt also for my subdomain, if I create a new virtualhost, can I target it on the same directory without to have problems with SSL?

fastxpert left a reply on Add New Fields To User Profile (standard Auth)? • 10 months ago

For such fields you need also ->nullable(), like:

Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('firstname')->nullable();
            $table->string('lastname')->nullable();
            $table->string('email')->unique();
            $table->string('ncin')->unique();
            $table->string('phone')->nullable();
            $table->string('password');
            $table->integer('userPrivilege');
            $table->rememberToken();
            $table->timestamps();
        });

I think you should add this fields also in your model $fillable...

24th November, 2017

fastxpert started a new conversation Reduce HTML With Ajax Loading And Collect Data For Saving Into DB? • 10 months ago

I have a list with tasks, every task has his options, actually I can select options by task at the same time for more tasks and save it as "operation", so a operation can have more options.

This works but I have to much HTML code and I see it during page loading.

My question is, if I make it over ajax, how can I collect this data and save it at once to have all this options in one "operation"?

10th October, 2017

fastxpert started a new conversation Allow API Read Only From One Address/project? • 1 year ago

I have 2 laravel projects, now I want to share data from one to another project over laravel api in json format.

What is the best way to restrict this rights only for 1 domain/project? It means I don't want to make my API public readable, but only to this one project.

23rd August, 2017

fastxpert started a new conversation Laravel Packages, Install Over Composer? • 1 year ago

I wrote a laravel package and commited everything to github public repository, what is still to do to get it as install pack for composer?

18th August, 2017

fastxpert started a new conversation Storage Recommendation? • 1 year ago

As everyone know laravel has fantastical storage options like local, s3 etc... but I'm in problem where to store data, if I use local storage and have a server by digitalocean, can I use there a other disc for storage because I want to have my data if server fails... is this recommended?

As second what I think, if I want some day to move on s3, can I simple copy all data or can it be a problem?

25th May, 2017

fastxpert left a reply on Best Practice For User Logs? • 1 year ago

Nothing?

24th May, 2017

fastxpert started a new conversation Best Practice For User Logs? • 1 year ago

What is the best practice to create user logs? I have a custom AuthController with login() & logout() methods, can I there simple add a user_log table insert, is this way correct?

Is there any possibility also to save session duration?

27th March, 2017

fastxpert left a reply on Request In Blade If A Specific Middleware Is Active? • 1 year ago

At the moment I only create middleware and assigned to my route group.

I want to set in blade, if this middleware is active (means the user is navigating in this route group) then I want to enable some html in view master... possible?

fastxpert left a reply on Request In Blade If A Specific Middleware Is Active? • 1 year ago

You mean it is to do through a middleware?

fastxpert started a new conversation Request In Blade If A Specific Middleware Is Active? • 1 year ago

I created a middleware and set on a group, it is ok. but can I do if request in my master template if this middleware is active?

23rd December, 2016

fastxpert started a new conversation Request On Route Group Or Namespace? • 1 year ago

Is in laravel possible to do a request on route group or any other parameter? I need to disable view composer for one route group... in route group is also namespace available

21st December, 2016

fastxpert left a reply on Get Data From A Table Through A Additional Table? • 1 year ago

Both are in model User:

I have this relation to get Companies from a user:

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

This is the relation what I tried to use:

public function roles() {
        return $this->belongsToMany('App\UserCompany', 'user_company')->withPivot('user_id', 'role_id');
    }

Is this correct?

fastxpert started a new conversation Get Data From A Table Through A Additional Table? • 1 year ago

Here is my scheme: https://s23.postimg.org/k1bq6mkjf/schema.png

I have a user who has more companies, after login he can select wich company... that's simple :), now I have roles implemented, a user can be sales in company A but in company B only manager. So if he is in a company logged I want to get his Role name, with which relation is that possible? I tried with belongsToMany in User model but it don't works:

public function roles() {
        return $this->belongsToMany('App\UserCompany', 'user_company')->withPivot('user_id', 'role_id');
    }

I needed something like: $user->role()->nameor $user->company()->role()->name becuase of company difference...

What I do wrong here and get no results...?

Edit Your Profile
Update

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