haizone

haizone

Member Since 1 Year Ago

Experience Points 5,290
Experience
Level
Lessons Completed 6
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

28 Oct
1 month ago

haizone left a reply on How Return Collaction From Get____Attribute

@staudenmeir i whant a category model collaction

haizone left a reply on How Return Collaction From Get____Attribute

@staudenmeir i get array with all the stuff but i whant that in a collaction

Collection {#2042 ▼

#items: array:20 [▼ "id" => 858 "parent_id" => 8 "lft" => 1304 "rgt" => 1305 "depth" => 1 "title" => "pizzeria" "slugi" => "pizzeria"

haizone started a new conversation Return Collaction From Get____Attribute

hi how i can return a collaction from a model with get____Attribute

i do somthing like that but its didnt work and still retun me an array:

     public function getBusinessCategoryAttribute(){
             return collect($this->business()->first()->categories()->first());
     }   

haizone left a reply on How Filter In Model File

i think its work like this:

return $this->hasMany('App\Models\Branch')
        ->where('business_id','>','0')
        ->whereHas('business', function ($query) {
        $query->where('rest', '1');
    });

haizone left a reply on How Filter In Model File

@jlrdw thanks but i whant that in the model only.

haizone started a new conversation How Filter In Model File

hi i have a model is name "city"

and i have that function: public function branches() { return $this->hasMany('App\Models\Branch') ->where('business_id','>','0'); }

i have table business has many branches.

now i whant only where in business.rest == 1 to filter that and get only where in business table in rest ==1

16 Oct
1 month ago

haizone started a new conversation How To Make The Vue Pats As Frindly Seo

hi

i have a parts inside my laravel blada tamptle and i whant to make thats parts seo frindly for google and all that

how i can do that? i know with nuxt, but how i install that in the vue with the laravel? becuse its parts of the site isnt all the site

thanks

27 Aug
3 months ago

haizone started a new conversation FullUrlWithQuery Didnt Work Current

i use that function fullUrlWithQuery

like that:

<a href="{{request()->fullUrlWithQuery([$field->id => $val])}}">

in the first time its get good Query like this:

http://localhost:8000/category/tv?53=Smart+TV

anat thet my $field->id jts 53 and its good

now i whant to add to that Query more params

but i get wrong $field->id in that function and its start with 0 and i need to get other number

if i look at the same link i get that:

http://localhost:8000/category/tv?0=Smart+TV&1=Smart+TV

its start with 0 and the send param its 1 but its need to be 53 like that:

http://localhost:8000/category/tv?53=Smart+TV&53=Smart+TV

id i print my $field->id i get 53, but only in the fullUrlWithQuery() function at the second time i get wrong numbersID why its append?

                          <a href="{{request()->fullUrlWithQuery([$field->id => $val])}}">
                                {{$val}} - {{$field->id}} - {{request()->fullUrlWithQuery([$field->id => $val])}}
                            </a>

i get that result:

Smart TV - 53 - http://localhost:8000/category/tv?0=Smart+TV&1=Smart+TV

haizone left a reply on How To Make Dynamic Route

@NOMGUY

thanks but i didnt whant to creat the route i whant to make that dynamic!

haizone started a new conversation How To Make Dynamic Route

hi

i whant to make a filter with dynamic route

its need to be somthing like that:

url: www.google.com/product/{product}/ios/2.3/what

and i whant to get the stuff aftre {product} and filters that with my system and get back a result

how i can to that

but the url can be other i didnt know what the params in the url and i didnt know how much pararm the user input in the url its can be url: www.google.com/product/{product}/android/5

haizone started a new conversation How To Use Filter After Paginate

hi

i have a list of products that i show with paginate(20)

its in cache

now i make a filter and i do that like this:

    if ($request->subject) {

    $products = $products->filter(function ($product) {
      return $product->specValues->whereIn('value',['Samsung'])->contains('field_id','1');
    })->count();

    }

now the filter work only on the first page and show me from the 20 products the products with that values

how i make that to show me from all the pages witour to call all the products again?

24 Aug
3 months ago

haizone left a reply on What Is The Best Way To Upload Laravel Api App To Aws?

@mknooihuisen thanks i see the AWS Lambda and i need somthing like that but for a php laravel app amazone have a service like that

i see that ican to use with a tutorial and make its work with laravel but i didnt think its a good suloation i search about aws service that i update my php files esayli and use composer to

thanks

23 Aug
3 months ago

haizone started a new conversation What Is The Best Way To Upload Laravel Api App To Aws?

hi

i have a backend with laravel and i use all the service of amazone

my frontend is nuxt.js

my DB is in RDS and my images is in S3

my frontend is in S3.

now my laravel app is in EC-2 and i want to get other why to upload my laravel app to amazone server

and i want the best way to upload to aws but witout EC-2,
i didnt want to open a server

somone know if in amazone have more option to upload my larvel app API and the server didnt down never (not like EC-2 that i have a size for the server. somthing like S3 but for the API service.

thanks for the answers

22 Aug
3 months ago

haizone left a reply on Count Collections After Groupby

@lostdreamer_nl

how i can do that in one line? like here:

 $field->specValues()->get()->groupby('value')

but with the count paramter and sort becuse i use that in my blada like here:

@foreach($field->specValues()->get()->groupby('value') as $key => $value)
                <label class="form-check">
                    <input class="form-check-input" value="" type="checkbox">
                    <span class="form-check-label">
                    <span class="float-right badge badge-light round">[{{count($value)}}]       `           </span>
                    {{$key}}
                    </span>
                </label>  <!-- form-check.// -->
            @endforeach

haizone started a new conversation Count Collections After Groupby

i make a groupby() in a Collections and i get that:

this is my code: $field->specValues()->get()->groupby('value')

and i get that result:

Collection {#1385 ▼ #items: array:45 [▼ "Nokia" => Collection {#813 ▼ #items: array:5 [▶] } "HTC" => Collection {#893 ▼ #items: array:22 [▶] } "Elephone" => Collection {#892 ▼ #items: array:4 [▶] } "Doogee" => Collection {#895 ▶} "Cubot" => Collection {#896 ▶} "ThL" => Collection {#898 ▶}

and i whant to add a sory by the count on the Collection inside the value here:

in Nokia => 5 array Elephone=> 4 HTC => 22 array

and i whant to sory in one code ($field->specValues()->get()->groupby('value')) need to continu to sort that by the Collection thay hve in the value

this need to be the result: HTC => 22 array Nokia => 5 array Elephone=> 4

thanks

21 Aug
3 months ago

haizone left a reply on Filter With MorphToMany

@tykus tahnks but how i can do somthing like that: return $product->specValues->whereIn('specvalued_id', '30')->whereIn('value','Nokia');

its didnt work :/

look here: http://prntscr.com/klab90

haizone left a reply on Filter With MorphToMany

@tykus great! its work!!

haizone left a reply on Filter With MorphToMany

@tykus thanks for the try but i get back all the products list like:

$products = $category->products()->with('specValues')->get();

As if we had not done a filter

haizone left a reply on Filter With MorphToMany

@NOMGUY that the error, i try all!!! but its didnt work

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'specValues.id' in       'where clause' (SQL: select `products`.*, `categorized`.`category_id` as `pivot_category_id`, `categorized`.`categorized_id` as `pivot_categorized_id`, `categorized`.`categorized_type` as `pivot_categorized_type` from `products` inner join `categorized` on `products`.`id` = `categorized`.`categorized_id` where `categorized`.`category_id` = 60 and `categorized`.`categorized_type` = Model\Product and `specValues`.`id` = 316)

haizone left a reply on Filter With MorphToMany

@NOMGUY the same:

Too few arguments to function Illuminate\Support\Collection::get(), 0 passed in

haizone left a reply on Filter With MorphToMany

@NOMGUY thanks but i get that error:

Too few arguments to function Illuminate\Support\Collection::get(), 0 passed in 

that what i do:

$products = $category->products()->with('specValues')->get();
$rr = $products->where('specValues.id', '=' ,  '316')->get();
dd( $rr );

haizone started a new conversation Filter With MorphToMany

i have a MorphToMany with categories and products

and i get the products belongs the category like that: $products = $category->products()->with('specValues')->get();

now i whant to use filter and get with a fild i have in specValues ( the specValues is a morphMany in my product model)

and i didnt fix that i try:

$products->whereHas('specValues', function ($q){
         $q->where('value', '2017');
 })->get();

and i try:

$products->where('specValues.id', '316'); 

but its didnt work somone know how i can fix that?

19 Aug
3 months ago
13 Aug
4 months ago

haizone left a reply on Laravel - Make A Filter With Relations

@s4muel yes somthing like that, but is didnt work i get that error: Maximum execution time of 300 seconds exceeded

haizone started a new conversation Laravel - Make A Filter With Relations

i have a product table with relations: "specValues"

in my product model:

public function specValues(){
    return $this->morphMany('App\Models\SpecValue', 'specvalued');
}

in my specValues in have:

class SpecValue extends Model
{
  use Cachable;

    protected $table = 'specvalued';

    protected $fillable = ['field_id', 'value', 'value_desc', 'link', 'specvalued_id', 'specvalued_type'];

    public $timestamps = false;

    public function specvalued()
    {
        return $this->morphTo();
    }
    public function field()
    {
        return $this->belongsTo('App\Models\SpecField','field_id');
    }
}

now i whant to make a filter and multi filter for the products list: with the "specvalued()" (from the specvalued table) i get the name (or id) and with the "value" fild" from the specvalued table

the specValues with product looks like this: ( i have alot like that but with a diffrent specvalued_id and value, and i whant a make a filter with that.

#attributes: array:8 [▼
            "id" => 354327
            "field_id" => 4
            "specvalued_id" => 27535 //(name = year)
            "specvalued_type" => "Model\Product"
            "value" => "2017"
            "value_desc" => null
            "link" => null
            "created_at" => "2017-09-03 10:12:30"
          ]

and i try to make somthing like that to get a products with spespic value from specValues table after filter:

$products = $category->products()->with('specValues')->
where ????
orderBy('position')->paginate(20);

how i do the where options with my info?

08 Aug
4 months ago

haizone started a new conversation BelongsToMany With Two Diffrent Mysql Connection

i have a 2 diffrent mysql connection

1 - mysql db

  • categories table

2 - articles db

  • article table
  • articles_categories table

i try to make a relationship with the two tables with a difrrent mysql conacction

but i get an error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'articles.categories' doesn't exist (SQL: select `categories`.*, `articles_categories`.`article_id` as `pivot_article_id`, `articles_categories`.`category_id` as `pivot_category_id` from `categories` inner join `articles_categories` on `categories`.`id` = `articles_categories`.`category_id` where `articles_categories`.`article_id` = 7)

categories db is inside mysql table and article and articles_categories is inside the articles db connaction

this is my code:

  public function categories(){

return $this->belongsToMany('App\Models\Category','articles_categories','article_id','category_id');

}

i think the laravel try to find the categories table in articles db but the categories table is inside the mysql db

i try to make that:

return $this->belongsToMany('App\Models\Category','mysql.articles_categories','article_id','category_id');

but is didnt work :/

thanks

07 Aug
4 months ago

haizone left a reply on Error: CacheTags ?

@fbss no

but i think its becuse i add to mysql the tags and didnt from the app

23 Jul
4 months ago

haizone started a new conversation Integration Mysql And Mongodb

how i can Integration with mysql DB and mongoDB i have a website and i have one table with 2M records and all the time bigger a friend tell me to move that to mongodb how i can do to that with laravel? somone have a tutorial for that i need only a one table to put in mongodb and need to be with Relationship to other table with mysql db

many thanks

20 Jul
4 months ago

haizone started a new conversation Get Geo Location With Vue

hi how i found the latitude and longitude of the user with the browser gps from computer and mobile with vue? but auto (if the gps are open)

thanks

19 Jul
4 months ago

haizone started a new conversation How To Make A Href With Url And Var

hi i try to do that but its didnt work and i didnt found an answers

 <a href="https://waze.com/ul?ll=".{{ $business->latitude  }}.",". {{$business->longitude }} ."&navigate=yes" class="btn btn-icon btn-primary">
                      

thanks

16 Jul
4 months ago

haizone left a reply on Problem With Find In Many To Many

its inside problem i my model i fix that

thanks

haizone started a new conversation Problem With Find In Many To Many

i have a problem

this code dosnt work:

    $businesses = Business::where('slug', $slug)
->with([
    'reviews' => function ($query) {
        $query->select('slugi', 'name');
    }
])->first(['id', 'name']);
return response()->json($businesses);

i get:

{

"id": 2852, "name": "biz name", "ReviewsCount": 17, "ReviewsAvg": "3.9", "reviews": [

] }

the reviews is empty (and i have a data inside)

but if i do like this:

$business = Business::where('slug', $slug)->first()->reviews()->get();

i get all the info

someone know what is the problem?

09 Jul
5 months ago

haizone started a new conversation Need A Help With A Filter In Vuejs

hi sorry about that msg but i didn know what to do

my english is didnt so good and i have a problem with my vue and i didnt know how to explain in a msg and find any help

so if somone can give me his skype and help me to fix my problem I would be very grateful

many thanks and sorry about that msg

08 Jul
5 months ago

haizone left a reply on Insert A Array To Array

@Sergiu17

that is my code

          for(var spec in this.productstores[pro].productspec){
          if(this.filters[spec].name === this.productstores[pro].productspec[spec].name){
            this.filters[spec]['filter'] = [this.productstores[pro].productspec[spec].pivot.value];
        }

now i get that :

0 :
   created_a:(...)
   filter:["111"]
   id:(...)
  name:(...)

i need in the filter: to get ["222","3333","111"] but the script all the time delete and show me only the last one and i whant to push to the array all time from the for loop to the array

thanks for the help

haizone started a new conversation Insert A Array To Array

i have a array ['one', 'two','trhee']

now i want to push into the array at index 0 more array and with for loop insert the value to the array

this is my code but is didnt work: this.filters[0].push(this.productstores[pro].productspec[spec].pivot.value);

i whant in this.filters[0] i get more array with options this.filters[0][0] and get a value when i print that

thanks

04 Jul
5 months ago

haizone left a reply on Get All The Other Id In Find()

@tomopongrac thanks its work but mybe have an other why to do that? maybe faster way

haizone started a new conversation Get All The Other Id In Find()

i have a function that i get all the records from the db i have in the db the ids: 1,2,3,4,5

$businessproduct->branches()->find([1,2,3]);

and i get in collection all of that id's - and its great!

but now i whant to get all the other id's (didnt inside the find() but thay in the relationships in this case the id's: 4,5 (in a collection - i need to get back)

i need to use a foreach or in laravel have a faster why to do that?

haizone left a reply on Eloquent Manytomany How To Work With Visible

@BishoyWagih i just do with sync and itsnt good

$businessproduct->branches()->sync($request->branches);

how i do that with pivot witout use sync and in once time: check if the records in the db if yes update the pivot else id didnt in the db inster the rerelationship with the pivot

haizone left a reply on Eloquent Manytomany How To Work With Visible

@BishoyWagih thanks i know that but i have a problem how i chack id the record find the table to updta him or insert him thw sync() do for me the all of that

haizone started a new conversation Eloquent Manytomany How To Work With Visible

i whant to use Eloquent manytomany but when i finish i get the table in the DB and all the time i use sync() function the records in the DB delete and add a new if i back the rerelationship

how i make a fild with visible and only change him in the DB when i sync() the rerelationship becuse i didnt whant to delete the record from the db

02 Jul
5 months ago

haizone started a new conversation How To Make That In Eloquent

hi i need a littlebit help with my tables:

table: product: -id -name

table: spec: -id -product_id -name

table: bizproduct: -id -name

table: bizProductSpec: -id -bizproduct_id -spec_id -value

how i make that and use with laravel?

how to make the relation betwen bizProductSpec and spec and bizproduct tables

and how to make hasMany and belogs to

i try but its didnt work to me :/

29 May
6 months ago

haizone left a reply on Search With Relationships

i do that and i get the products: $items = Business::where('id',$business->id)->with(['products' => function($query) use ($search) { $query->where('name', 'LIKE', '%' . $search . '%') ->orWhere('english_name', 'LIKE', '%' . $search . '%') ->orWhere('model', 'LIKE', '%' . $search . '%'); }])->paginate(10);

but i get a json with Business and inside more json with products becouse of that the paginate didnt work :/

and i whant to get only the products

haizone left a reply on Search With Relationships

@Sergiu17 thanks again but it didnt work i get the same problem

i whant to search for a products that belongs to spasific business and i have the business in var $business in products table i have a business_id

haizone left a reply on Search With Relationships

@Sergiu17 thanks i get an error and i cant fix that:

Parse error: syntax error, unexpected '}'

thanks for the help

haizone started a new conversation Search With Relationships

hi

i have a problem i try to search on a relationships and i get all the items from the model back

that what i do:

i have a table "products" with 70,000 items

now i have a business with products , when i search and use get() i get a 250 results but if i do like this code with search i get "total_items": 30527 and i need to see only 250 in here

   $items = $business->products()->where('name', 'LIKE', '%' . $search . '%')
                       ->orwhere('english_name', 'LIKE', '%' . $search . '%')
                       ->orwhere('model', 'LIKE', '%' . $search . '%')
              ->orderBy('updated_at','ASC')->paginate(10);

what i do wrong?

24 May
6 months ago

haizone started a new conversation Add Dyanmic Url To Data->items()

hi i use $items->items()

to get my data with api

and i get the data

how i can add to eche of data in my array a dynamic url here a pic of my array http://prntscr.com/jm0m7d

    $response = [
           'data' => $items->items()
        ];

i get data like this:

        "data": [
            {
            "id": 1,
            "reviewable_id": 2863,
            "rating": 5,
            "shipping": 0,
            "customer_service": 0,
            "updated_at": "2018-01-06 08:39:50",
            "created_at": "2017-10-09 16:43:52"
            },
        ]

and i whant more dynamic url but only for this api response and not for all the time witour to add attribute to model

haizone left a reply on Paa A Props Data But Get An Null Error

@Sergiu17 i get the same error:

app.js:37202 [Vue warn]: Error in mounted hook: "ReferenceError: padination is not defined"

found in

---> at resources\assets\js\components\pagination.vue