mfadel

mfadel

Member Since 3 Years Ago

Experience Points 5,990
Experience Level 2

4,010 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 54
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

26 Sep
1 year ago

mfadel left a reply on Where Are You All From?

I am Syrian, living in Istanbul,

mfadel left a reply on Default Timeout For CURL In Laravel

I have a similiar problem that I am trying to solve, I am trying to post products from web page using curl, I am having this error

(1/1) HttpClientException cURL Error: Operation timed out after 15000 milliseconds with 13630 bytes received in HttpClient.php (line 380),

I am trying to solve it, any clues?

17 Aug
1 year ago

mfadel left a reply on Laravel And E-Commerce

any update based on your experiences, which one of the systems is the best?

23 Dec
2 years ago

mfadel started a new conversation Autocomplete Source Doesn't Return Json Data, But Normal View Page

I am trying to include an autocomplete for an input, but it doesn't return anything in chrome it gives

Uncaught SyntaxError: Unexpected token <

in firefox it gives this error:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data[Learn More]

Here in the Routes file web.php,

    Route::get('shipment/autocomplete', '[email protected]');

Here is the controller file ShipmentController.php :

    public function autocomplete(Request $request){
        $term = $request->input('term');
        
        $results = array();
        
        $queries = DB::table('areas')
            ->where('name', 'LIKE', '%'.$term.'%')
            ->take(10)->get();
        
        foreach ($queries as $query)
        {
            $results[] = [ 'id' => $query->id, 'value' => $query->name ];
        }
    return \Response::json($results);
    }

here is the view:

html:
<input class="form-control" id="area" name="area" placeholder="" ></input>
javascript: 
$( "#area" ).autocomplete({
            source: "/shipment/autocomplete",
            minLength: 2,
            select: function(event, ui) {
                $('#area').val(ui.item.value);
            }
        });

What could be the solution?

19 Oct
2 years ago

mfadel left a reply on Laravel Can't Access Resources When Route Like "/orders/list" But Access Them When "route/orderlist"

Thanks giovanniciriello,

well I forgot to make my resources like {{ur::assest }}, that was the problem, thanks

18 Oct
2 years ago

mfadel left a reply on Laravel Can't Access Resources When Route Like "/orders/list" But Access Them When "route/orderlist"

I am just using @extends('layouts') in layouts.blade.php all the resources are called,

mfadel started a new conversation Laravel Doesn't Access Resources When Route Like "/orders/list" But Access Them When "route/orderlist"

Hello every, I integrated LTE-Admin https://github.com/almasaeed2010/AdminLTE with my current app, when I type http://localhost:8000/orderslist it reaches all resources : js, css, images, but when accessing http://localhost:8000/orders/list it shows missing resources, like this message

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8000/orders/dist/css/skins/skin-blue.min.css

I want to use this route '/orders/list' not this '/orderslist', how can I solve failed to load resources error??? these are the routes:

Route::get('/orderslist','[email protected]'); Route::get('/orders/list','[email protected]');

17 Oct
2 years ago

mfadel left a reply on Send Data From View To Contorller

the last code helped, thanks,

mfadel left a reply on Send Data From View To Contorller

I want the user to be able to print from this view: orders.list, so I redirect it to printOrder(), but how to send those data from $results?

public function showReadyOrders(){
    $client = new Client();
    $res = $client->request('POST','http://website.com/getReady.php');
    $results = $res->getBody()->getContents();
    $results = json_decode($results,true);
    return view('orders.list')->with('results',$results);
}
public function printOrder(){
    $pdf = \App::make('dompdf.wrapper');
    $pdf->loadHTML('<h1>data</h1>');
    return $pdf->stream();

}

mfadel left a reply on Send Data From View To Contorller

I get $results from another function in the same controller, but they are not from database, it is from api, json file,

mfadel started a new conversation Send Data From View To Contorller

I want to send this code to a function in the controller, I want to send $row var to the controller, so I can print them, this is my view:

@extends('layouts')

@section('content')

     @foreach($results as $row)
      <h3>Siparış</h3>
      <div class="row">
            <h4>Name:  {{ $row['store_name'] }} </h4>
            <h4>Name : {{ $row['payment_firstname']  }}   {{ $row['payment_lastname']}} </h4>
            <h4>Telephone :   {{ $row['telephone'] }} </h4>
            <h4>Adress:       {{ $row['payment_address_1']}}  {{$row['payment_address_2']}} </h4>
            <h4>City :       {{ $row['payment_zone'] }}</h4>
            <h4>Total:       {{ $row['total'] }}</h4>
            <div class="col-sm-4">
                <button class='form form-control btn btn-primary' onclick="window.location='{{ url("orders/print") }}'"> Print </button>
            </div>
      </div>
     @endforeach
        
    
           
</div>

@endsection

How can I do that?

15 Oct
2 years ago

mfadel left a reply on Views Shows No Data: JSON Data From URL,

I am sorry to bother, but your answers helped me solving it, you know beginner, it has been months since last time I wrote Laravel code,

mfadel left a reply on Views Shows No Data: JSON Data From URL,

I solved it it was a mistake I put

@section('content') @foreach(json_decode($results, true) as $member) ID : {{ $member->id }} @endforeach @endsection

there was no need for @section('content') ........ @endsection

14 Oct
2 years ago

mfadel left a reply on Views Shows No Data: JSON Data From URL,

it shows this:

ErrorException in 1edde6fde4708b88bb4a17f0cf43780d73835635.php line 83: Trying to get property of non-object (...... resources/views/welcome.blade.php)

mfadel started a new conversation Views Shows No Data: JSON Data From URL,

I am trying to show json data in the view, but it shows no data, empty, Here is the code from the view, @foreach(json_decode($results, true) as $member) ID : {{ $member['id'] }} @endforeach

Here is the code from the controller:

use GuzzleHttp\Client; ...... public function getOrders() { $client = new Client(); $res = $client->request('POST','http://url/ttt.json'); $results = $res->getBody(); return view('welcome')->with('results',$results); }

here is the code from the routes.php

Route::get('/orders','[email protected]');

here is my json:

{ "member" :{ "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }

}

12 May
3 years ago

mfadel left a reply on Creating A Select In Laravel 5 Form Shows Html Elements

But I wonder why this works : {!! Form::text('dimension_y',null,['class'=> 'form-control'])!!} and this {{ Form::select('number', [1, 2, 3], null, ['class' => 'field']) }} didn't work?

mfadel left a reply on Creating A Select In Laravel 5 Form Shows Html Elements

I have found it,

<?php   echo Form::select('size', array('L' => 'Large', 'S' => 'Small'), 'S'); ?>

I thought it can be solved like textboxes,

mfadel started a new conversation Creating A Select In Laravel 5 Form Shows Html Elements

I am trying to create a select in my view using this code, I have searched the web and couldn't find an answer,

<div class="form-group">
    {{ Form::select('number', [1, 2, 3], null, ['class' => 'field']) }}
</div>
<div class="form-group">
{!! Form::label('Sort') !!}

{{ Form::selectRange('sort_id', 0, 10, 0, ['class' => 'field']) }}
</div>

but in the browser it shows

Sort 012345678910

123

What is the right code to create a select in a frame?

10 May
3 years ago

mfadel left a reply on Call To A Member Function GetClientOriginalExtension() On A Non-object

I solved it by changing

$imageName = $Mob->id.'.'.$request->file('image')->getClientOriginalExtension();

to

$imageName = $request->file('image')->getClientOriginalExtension();

thanks anyways

09 May
3 years ago

mfadel left a reply on Call To A Member Function GetClientOriginalExtension() On A Non-object

I have already done that in my view,

{!! Form::open(array('url'=>'mobile', 'files' => true)) !!}
<div class="form-group">

mfadel started a new conversation Call To A Member Function GetClientOriginalExtension() On A Non-object

Hello everyone, I am trying to store a record in the database, I have to use use Illuminate\Http\Request;
to get files uploaded, but I get this message

FatalErrorException in MobileController.php line 51: Call to a member function getClientOriginalExtension() on a non-object

namespace App\Http\Controllers;

use App\Http\Requests; use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

use App\Mobile; public function store(Request $request) { $this->validate($request,['name'=>'required', 'dimension_x'=>'required','dimension_y'=>'required','weight'=>'required']); $mobile = $request->all(); $Mob = Mobile::create($mobile);

    $imageName = $Mob->id.'.'.$request->file('image')->getClientOriginalExtension();
    $request->file('image')->move(base_path().'/public/images/devices/',$imageName);


    return redirect('mobile');
}

What should I change in my code?

06 May
3 years ago

mfadel left a reply on Laravel 5.1: BadMethodCallException After Adding GeneratorsServiceProvider To Config/app.php

thanks I already stopped it, I won't do it, I started something else

mfadel left a reply on Laravel 5.1: BadMethodCallException After Adding GeneratorsServiceProvider To Config/app.php

yes, I executed composer require way/generators -- dev,

well how can I add GeneratorsServiceProvider to any Laravel project?

mfadel started a new conversation BadMethodCallException After Adding GeneratorsServiceProvider To Config/app.php

Hello everybody, As it is explained in this video https://laracasts.com/series/build-a-laravel-app-from-scratch/episodes/2 I was trying to add 'Way\Generators\GeneratorsServiceProvider', to app.config, and then I tried to php artisan, and it showed a message [BadMethodCallException]
Call to undefined method [package] If I delete that line it shows no problem

 /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Routing\ControllerServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    'Way\Generators\GeneratorsServiceProvider',
29 Apr
3 years ago

mfadel left a reply on Error When Uploading A File Call To Undefined Method Illuminate\Support\Facades\Request::file()

thanks d3xt3r,

now I have a problem I can't use $mobile = Request::all(); in this line it will show this message,

Non-static method Illuminate\Http\Request::all() should not be called statically, assuming $this from incompatible context

mfadel started a new conversation Error When Uploading A File Call To Undefined Method Illuminate\Support\Facades\Request::file()

Hello everybody,

I am trying to upload a file using $request->file('image') I have posted the code of the function and uses below, when I execute http://localhost:8000/mobile/create and then add my data and submit it goes to http://localhost:8000/mobile and I get this error FatalErrorException in MobileController.php line 48: Call to undefined method Illuminate\Support\Facades\Request::file()

How can I make the upload file functionality??? Any help?

use App\Http\Requests; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Request;

use App\Mobile; //use Request;

class MobileController extends Controller { /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $mobile = Request::all(); $Mob = Mobile::create($mobile); $imageName = $Mob->id.'.'.$request->file('image')->getClientOriginalExtension(); $request->file('image')->move(base_path().'/public/images/devices/',$imageName);

    return redirect('mobile');
}

}