Nasr1

Nasr1

Member Since 1 Year Ago

Experience Points 1,620
Experience Level 1

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

11 Feb
1 week ago

Nasr1 started a new conversation Laravel 42000 Syntax Error Or Access Voilation 1064 You Have An Error In Sql Syntax

am using notification in my project i got this Image of Yaktocat

this is my code : Image of Yaktocat

it works good in my local machine ,but not when i deploying it , any help plz

17 Nov
3 months ago

Nasr1 left a reply on Get The Relationship Of A Relationship

@palak27 thank you bro i have figured it out but thank you :)

Nasr1 started a new conversation Get The Relationship Of A Relationship

so i have a slider , which has many to many relationship with products ,

        $sliders = Slider::with('products')->with('translations')->paginate(5);
        return  $sliders;

i want to load a product relationship too . for ex , the translation relationship in product model how can i do this ?

02 Nov
3 months ago

Nasr1 started a new conversation Shoping CART APIs

i have every thing ready for ecommerce webiste , gust the CART , i have no idea what to do , i have used https://github.com/Crinsane/LaravelShoppingcart tried to consume it For APIs , couldnt do it , also i want to undertand if i will build cart for api do i need to use the session or the token ? plz help guys

24 Oct
3 months ago

Nasr1 left a reply on One Record With Status = 1 Others = 0

@Cronix am using CMS , Voyager , it suppose when ever a slider is created or updated with ACTIVE , all other sliders should be inactive

Nasr1 left a reply on One Record With Status = 1 Others = 0

thanks brother @Snapy as always , u r the saver , but still i don know where to do this or when ?

Nasr1 started a new conversation One Record With Status = 1 Others = 0

so what i want is , in dashborad there is a slider and a user can create many , what i want to do if a slider selected As ACTIVATED all other sliders set to INACTIVE , as only one recored can have status = active or 1 and then automatically it make the reset of recoreds or the one before disactive or 0 , plz help me any this , thanks in advance ^^

23 Oct
3 months ago

Nasr1 left a reply on Build A Slider

@Borisu thansk bro , but i want to do it ! i want to know the best practice to create such a feature with laravel !

22 Oct
4 months ago

Nasr1 left a reply on Show Products With The Unique Category

Build a belongsToMany relation in both models , and then :- $products = Product::all(); $products->with('categories'); // in which categories is the name of the belongsToMany relation in the model

if you want to get products for certain cateogry , in show method , so something like this :-

/**
 * Display the specified resource.
 *
 * @param  \App\Category  $Category
 * @return \Illuminate\Http\Response
 */
public function show(Category $category)
{
    $category->setRelation('products', $category->products()->paginate(10));        
    return $this->showOnePaginate($category, 200);
}

Nasr1 started a new conversation Build A Slider

Hello guys , so am building a slider for products , Iam using Voyager as AdminPanel , and Iam asked to build a slider in which he can choose the Product and assign to it an Image to be seen in the slider ,

I see that will be complicated , so i told him , i will create a field in Product for SliderImage , and leave the image to be taken from product and i creating slider it will only pick products thats it , some thing like this : https://ibb.co/kajnMV

But he dont want this , he want in slider section he can choose product and choose its image for the slider , what can i do , or how can i convince him that its hard or i don know any idea guys .

10 Oct
4 months ago

Nasr1 left a reply on Best Laravel Host Server

@skoobi thansk skoobi for replaying to me , well we have many apps to be deployed in one server , so i will need a host with much storage , not necessarly SSD , something normal ,

i care only for storage capcaity and number of sub domains i can create .

Nasr1 started a new conversation Best Laravel Host Server

Hello , am working in a startup company my manager ask me , to find best server to move all our laravel apps into it , we were using shared hosting but by time we r consuming much money , so can some one please help me to find me some thing not expensive and good server .

thanks in advance guys :)

08 Oct
4 months ago

Nasr1 left a reply on How To Paginate Eloquent HasMany Relation?

@zymawy thanks brothers , this is the golden solution , god bless u :)

07 May
9 months ago

Nasr1 started a new conversation Forgetpassword Change User Model To Customer Model (another Model)

the forgetpassword prebuild controller in laravel , i built another model called customer , and i want to use this controllers to reset password for customer model not user model , please help

29 Jan
1 year ago

Nasr1 started a new conversation Jquery Data Table Generate On Collapse Div

Hello Awesome people , am using jquery to create data table , its working fine in a single page that show up the data , but i tried to put this data table in a collpase div so that when i collapse a div i get the data table , some thing like that :- https://imgur.com/a/0Y2Tj but as u can see from image there is no data at all , i know that the default action in jquery is click not collapse , so how i can edit my jquery so that when i press the collapse element it give me the data table , thanks in advance . @foreach ($season->CompetitionSeasonGroups as $count2 => $group)

                                    <div class="panel panel-default bx-shadow-none">
                                        <div class="panel-heading" role="tab" id="headingOne">
                                            <h4 class="panel-title">
                                                <a role="button" data-toggle="collapse"
                                                   data-parent="#accordion" href="#{{ $group->Id }}"
                                                  @if($count2 == 0) aria-expanded="true" @else aria-expanded="false" @endif aria-controls="collapseOne">
                                                    {{ $group->Name }}
                                                </a>
                                            </h4>
                                        </div>
                                        <div id="{{ $group->Id }}" @if($count2 == 0) class="panel-collapse collapse in" @else class="panel-collapse collapse" @endif
                                             role="tabpanel" aria-labelledby="headingOne">
                                            <div class="panel-body">
                                                {{ $group->Id }}
                                                <style type="text/css">
                                                    .paginate_button
                                                    {
                                                        margin: 10px;
                                                    }
                                                </style>

@if(isset($message)) {{$message}} @endif

Competitions

New Competition Identification Number Name Arabic Name Number Of Teams Created At Updated At
        <tfoot style="display:none">
            <tr>
                <th>Identification Number</th>
                <th>Name</th>
                <th>Arabic Name</th>
                <th>Number Of Teams</th>
                <th>Created At</th>
                <th>Updated At</th>
                <th></th>
            </tr>
        </tfoot>
    </table>
</div>

@section('scripts')

$(function(){ $('#msg').delay(2000).fadeOut(1000); });
function getUsers() {
    $('#competitionTable').dataTable({
    "processing": false,
    "responsive": true,
    "bDestroy": true,
    language: {
        search: "_INPUT_",
        searchPlaceholder: "Search",
        "sLengthMenu": "Display _MENU_ Records",
        "paginate": {
            "previous": "Previous",
            "next": "Next",
            "info": "Showing page _PAGE_ of _PAGES_",
            "infoEmpty": "No records available"
        }
    },
    "ajax": {
            "url": "{{URL::route('allCompetitions')}}",
            "dataSrc": "",
    },
    columns: [
         { data: 'Id' },
         { data: 'Name' },
         { data: 'ArName' },
         { data: 'NumberOfTeams' },
         { data: 'created_at' },
         { data: 'updated_at' }
    ],
    columnDefs: [
       {
           "render": function (data, type, row) {
                return '<a href="/hub/public/players/editView/'+row['id']+'" title="Edit"><img src="{{URL::asset('assets/images/edit.png')}}" width="30px" /></a> | ' +
               '<a href="#" onclick="RemoveUser(' + row['id'] + '); return false; " title="Delete"><img src="{{URL::asset('assets/images/delete.png')}}" width="30px" /></a> | ' +
               '<a href="{{url('/')}}/competition/'+row['Id']+'" title="Show Information"><img src="{{URL::asset('assets/images/info.png')}}" width="30px"/></a>';

           }, "targets": 6
       }
    ]

});
}

$(function () {
    $('#competitionTable').on('draw.dt', function () {
        $('.footable').footable({
            breakpoints: {
                phone: 480,
                tablet: 800
            }
        });
    });
    getUsers();
});

function RemoveUser(id) {
    var chk = confirm('Sure to delete?');
    if (chk == true) {
        $('#err_Desc').html('<img src="{{URL::asset('assets/images/ellipsis.gif')}}" />').css({ 'background-color': '#171B21', 'padding': '10px' }).fadeIn(400);
        $.ajax({
                url: "{{URL::route('userDestroy')}}",
                dataSrc: "",
                data: {'id': id, 'user_id': "{{Auth::user()->id}}"},
                type:'POST',
                success: OnRequestCompleted
        });
    }
}
function OnRequestCompleted(response) {
    if (response.Status) {
        setPopup(response.Message, 'green', 1500);
    }
    else {
        setPopup(response.Message, '#DD0B0B', 1500);
    }
    $('#err_Desc').fadeOut(300);
    $('#sumbitBtn').attr('disbaled', false);
    getUsers();
}
</script>

@endsection

14 Jan
1 year ago

Nasr1 started a new conversation Handling Multiple Objects In One Action Method

so i have this json object :- { "Id": 2, "Name": "Nasr City Tournament - Seventh District", "ArName": "دورة مدينة نصر - الحى السابع", "LogoUrl": "https://www.shopaardvark.com/media/catalog/product/W/S/WS-17642.jpg", "CompetitionTypeId": 2, "NumberOfTeams": 16, "YellowCardsToSuspend": 2, "CupImageUrl": "https://upload.wikimedia.org/wikipedia/en/thumb/4/4e/FIFA_Club_World_Cup_logo.svg/450px-FIFA_Club_World_Cup_logo.svg.png", "created_at": "2017-12-31 09:40:45", "updated_at": "2017-12-31 09:40:45", "competition_seasons": [], "competition_rounds": [] } in which each object depend on the object before it, i need to be able to create only one action method to handle this big object how i do this in laravel , or i mean how to create one action method to handle group of objects . please i need help and thanks in advance :)

13 Jan
1 year ago

Nasr1 left a reply on Next Next Save Form

how i do this in the front end too @topvillas and thks bro

Nasr1 started a new conversation Next Next Save Form

i want to make a form in which it contain multible steps forms , you have to finish a form to enter the next one at the final form there will be a save button , i want to know how i do this any tips any code any thing would be apperciated :) thnks in advance

16 Oct
1 year ago

Nasr1 left a reply on How Can I Make This Text Box

Thank u very much Guys

Nasr1 started a new conversation How Can I Make This Text Box

how can i make this text box in the image? https://imgur.com/a/0UjQJ

am building the form in the image , and i don't know how to make a text box that accepts multiple values , "As when i write a value in the textBox then click space , the value i written i getting highlighted and then i put the second value" like in stackoverflow when You ask Your question and select the Tags plz help me thanks advance .

10 Oct
1 year ago

Nasr1 started a new conversation How To Edit The (on Delete Cascade ) About A Column On Table

i have a simple database with columns like bus , user i want to edit bus column in delete restrict , how to do that , should i sue update query or what please help me , am new to mysql .

03 Oct
1 year ago

Nasr1 left a reply on Api Documentation Generator

Ohhh i figure it out , i wasnt using @resource in the controllers comment that made the problem

Nasr1 left a reply on Api Documentation Generator

@tisuchi thanks bro , am using it and worked fine but for gust one controller for many controller it produce an error "[ReflectionException] Method all does not exist" so what to do ?

01 Oct
1 year ago

Nasr1 left a reply on Api Documentation Generator

look bro am new to laravel , and i still don know how to use it , i did installed it , but when i run " php artisan api:generate --routePrefix="/api/v1/* " where my routes file is :- Route::group(['prefix'=>'api/v1'],function(){

Route::get('/route/index', '[email protected]')->name('indexRoute'); Route::get('/route/create', '[email protected]')->name('createRoute');

});

but in the index.html i got NOTHING plz help me

30 Sep
1 year ago

Nasr1 started a new conversation Api Documentation Generator

am new with laravel , i know that there are packages out there that generate the api doc , but i dont know which is better ? and how to use it ? thanks in advance .

25 Sep
1 year ago

Nasr1 left a reply on Building API Using Laravel 5.5

passport is for auth and it's not necessarily jwt is simple and will do the job , i want to know how to use the registration and login controllers that already build in laravel for API to save me time .

Nasr1 started a new conversation Building API Using Laravel 5.5

Hello good people , Am using Laravel 5.5 , and i want to build an API for registration and login .i can build it but wondering if there is something with laravel already build that can make my life easier when building API, if so how can i use it , is there a tutorials or books or articels or libraries that i can use to fully understand the already built in laravel 5.5 functions for API . thanks in advance :)

23 Sep
1 year ago

Nasr1 left a reply on A Website For Getting A Template Database

am making an application for football teams , as a user will be able to make a team and participate in a league @neilherbertuk , is even a website for database examples to learn from it , a website or abook that have manyyyyy databases example , so i can understand relations and tables and what cloums for tables . @Snapey

Nasr1 started a new conversation A Website For Getting A Template Database

is any website to get a database template already made so that i use it instead of making a new on from scratch , thanks in advance :)

09 Sep
1 year ago

Nasr1 left a reply on Edit Button Return In The Url %7Bid%7 !!!

i used

href="/projectName/buses/edit/' + row['Id'] + '"

worked as a charm

05 Sep
1 year ago

Nasr1 started a new conversation Edit Button Return In The Url %7Bid%7 !!!

i have this function for when i press edit or delete button , it redirect me to edit page , but when i press the button , the url is changed to a strange value {http://localhost/projectName/buses/edit/%7Bid%7D1}

this is my code in the view for the buttons :- { return ' | ' + ''; }

04 Sep
1 year ago

Nasr1 left a reply on 127.0.53.53 When Pining Laravel Project !!!

Thank You My friend @papa For Your great answer it reveal every thing to me , so from what i understand , the problem is on my tld in my project name , that is ".dev" as there is the same .dev name in the list u mentioned, right ? , so how to solve the problem , how to make my browser its first priority to not search in the web for my project name or some thing like this ? i mean how to solve it bro , knowing that i have my wamp server running ? Thank You Very Much :) .

Nasr1 started a new conversation 127.0.53.53 When Pining Laravel Project !!!

Guys , i wanted to replace localhost with the name of the proejct for example"lara.dev", so i edit my hosts file and my vhost apache file , so that my project name replace the localhost name , when i used my project name "lara.dev" in the browser , it responded with {{This site on the company, organization or school intranet has the same URL as an external website.

Try contacting your system administrator. ERR_ICANN_NAME_COLLISION }}

so I opened cmd , and pinged my project name "lara.dev" , it respond with {{Reply from 127.0.53.53: bytes=32 time<1ms TTL=128}} NOT 127.0.0.1 !!! , How on earth this ip 127.0.53.53 appear ?!! :D thanks in advance guys ^^

29 Aug
1 year ago

Nasr1 started a new conversation Old Value In Update Form

where to put old value in updated form , where my tag is :- {!!Form::text('Name',null,array('required' => 'required', 'id' => 'Name', 'class'=>'form- control'))!!}

              </div>

for example {{$route->name}} this is the variable the has the old value of route name , where to put it so that its value appear in the field in the updated from.

28 Aug
1 year ago

Nasr1 started a new conversation GoogleMapApi Show Old Coordinate Values In The Update Form

Hello people, am building an update page for edit a user Information include its coordinates , this is a picture to clear things out :- http://imgur.com/a/hezWc

so in the edit form i able to produce the old values of the fields , but when it came to ,google map fields i did'nt able to since its Javescript and i have no idea how to do this , and am not even sure what to use to overwrite values of the coordinates ... this is my action methoed for the storing update info of the user :- public function update(Request $request,$id) { $loc = $request::get('loc'); $pickup_loc = $request::get('pickup_loc'); $dropoff_loc = $request::get('dropoff_loc'); $name = $request::get('name'); $password = $request::get('password'); $email = $request::get('email'); $mobileNo = $request::get('mobileNo'); $age = $request::get('age'); $gender = $request::get('gender'); $organizationId = $request::get('organizationId'); $busId = $request::get('busId');

    $user =\App\User::find($id);
    $user->name = $name;
    $user->password = \Illuminate\Support\Facades\Hash::make($password);
    $user->email = $email;
    $user->mobileNo = $mobileNo;
    $user->age = $age;
    $user->gender = $gender;
    $user->organizationId = $organizationId;
    $user->busId = $busId;
    $user->Location = $loc;
    $user->CheckInLocation = $pickup_loc;
    $user->CheckOutLocation = $dropoff_loc;
    
    $user->save();
    Session::flash('success','The User Was Successfully Updated');
    return 'test updated successed';
}

and this is edit form tag that responsible to get the coordinates of google map :-

     <div class="form-group">
        <label class="control-label col-md-2" for="Locations">Locations</label>
        <div class="col-md-10">
            <button id="stop_btn" disabled="disabled" class="btn btn-default"                                               
          onclick="locationClick();this.disabled = 'disabled';">Location</button>
            <button id="pick_btn" class="btn btn-info" onclick="pickClick(); 
    this.disabled = 'disabled';">Pickup Location</button>
            <button id="drop_btn" class="btn btn-danger" onclick="dropClick(); this.disabled =              
                         'disabled';">Dropoff Location</button>
            <div id="map" value="{{ $user->CheckOutLocation }}"></div>

        </div>
    </div>

please help me guys , i know that its not much related with laravel more than javescript , so any thing would be cool even tips would be great. , and thanks in advance

Nasr1 left a reply on How To Make My Routes Implement Session In Laravel 5.1

i made another routemiddleware called 'session' in protected $routeMiddleware

    'session'=> \Illuminate\Session\Middleware\StartSession::class,

is this right ?

Nasr1 started a new conversation How To My Route Implement Session In Laravel 5.1

Hello am making a simple Session::flash so i need to make my controller to use middleware , i know i can use middleware web , unfortuentaly am using laravel 5.1 , so web middleware is not exist , so what middleware or what should i do to make my controller or my routes implement session ? this is my kernel file :-

class Kernel extends HttpKernel

{ /** * The application's global HTTP middleware stack. * * @var array */ protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, //\App\Http\Middleware\VerifyCsrfToken::class, ];

/**
 * The application's route middleware.
 *
 * @var array
 */
protected $routeMiddleware = [
    'auth' => \App\Http\Middleware\Authenticate::class,
    'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
    'jwt.auth' => 'Tymon\JWTAuth\Middleware\GetUserFromToken',
'jwt.refresh' => 'Tymon\JWTAuth\Middleware\RefreshToken',
];

thanks in advance Guys :)

Nasr1 left a reply on MethodNotAllowedHttpException

@Dry7 Thanks bro :)

27 Aug
1 year ago

Nasr1 started a new conversation MethodNotAllowedHttpException

hello good people , this is my update route :

Route::put('/buses/{id}', '[email protected]');

this is the top of my edit view

{!! Form::model($bus,['route'=>['buses.update',$bus->Id], 'method'=> 'PUT']) !!}

now how to get rid of this MethodNotAllowedHttpException

thanks guys :)

Nasr1 left a reply on Use Model Binding To Get Old Values In The Form

yes bro i already did that , i want to know where to put the variable that carry the old value in this field or div

    <div class="form-group">
        <label class="control-label col-md-2" for="Supervisor">Supervisor</label>
        <div class="col-md-10">
            <select class="form-control" name="supervisorId" value="$bus->supervisorId">
            @foreach($supervisors as $item)
              <option value="{{$item->id}}">{{$item->name}}</option>
            @endforeach
          </select>
        </div>
    </div>

thanks again bro :)

Nasr1 left a reply on Use Model Binding To Get Old Values In The Form

i have this field also : Supervisor @foreach($supervisors as $item) {{$item->name}} @endforeach it depond on onther model called supervisor but i made a relation between supervisor and buses Bus Model :-

protected $fillable = ['busnumber', 'capacity', 'routeId', 'supervisorId', 'organizationId', 'isactive'];

public function supervisor() { return $this->belongsTo('\App\User', 'supervisorId', 'Id'); }

where do i set its old value in the above div , thank u @coder_uzb

Nasr1 left a reply on Use Model Binding To Get Old Values In The Form

Thank u very much guys , u really helped me out there ^^

Nasr1 started a new conversation Use Model Binding To Get Old Values In The Form

hello , am building an update form , i need in the edit page the old values or the values that need to be edited appear in ther fields , now this is my edit.blade.php:-

{!! Form::model(array($bus,['route'=>['buses.update',$bus->Id]])) !!}

Edit Bus

//this is one of the fields

Capacity
            {!! Form::text('capacity', null, [
        'class'                         => 'form-control',
        'placeholder'                   => 'Capacity',
        'required',
        'id'                            => 'capacity',
        'data-parsley-required-message' => 'Capacity is required',
        'data-parsley-trigger'          => 'change focusout',
        'data-parsley-type'             => 'digits'
    ]) !!}
        </div>

//BUS edit action method :-

public function edit($id)
{
    $bus=\App\Models\Bus::find($id);

    return view('buses.edit')->withBus($bus);
}

NOW WHAT TO DO TO MAKE THE OLD VALUES APPEAR PLZ HELP ME

Nasr1 started a new conversation Form::model " Files=>true " Used For

hello i want to know what is files=> true used for in form ?

06 Aug
1 year ago

Nasr1 left a reply on Getting User Registeration Info When Login , In Postman

yeah i figured it out , but thank u bro :)

05 Aug
1 year ago

Nasr1 started a new conversation Getting User Registeration Info When Login , In Postman

this is my code for login action method : public function login(LoginRequest $request, JWTAuth $JWTAuth) { $credentials = $request->only(['email', 'password']);

    try {
        $token = $JWTAuth->attempt($credentials);

        if(!$token) {
            throw new AccessDeniedHttpException();
        }

    } catch (JWTException $e) {
        throw new HttpException(500);
    }
    $user = new User($request->all());
    return response()
        ->json([
            'status' => 'ok',
            'token' => $token
        ]);

what should i do to make it back not only the token but also all the info of the user registered like its username password email etc , thk guys