anikkhan

anikkhan

Member Since 4 Years Ago

Experience Points 8,640
Experience Level 2

1,360 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 100
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.

04 Apr
1 year ago

anikkhan started a new conversation Filesize(): Stat Failed For

Hey everyone i keep getting this error

filesize(): stat failed for /Users/username/Desktop/Projects/iplayer/storage/track_files/aari_7/track_files/aari_7/LNMqyLGcXnsWbUTIi4168qgBS.mp3

my controller

public function stream(Request $request){

        $trackId = $request->get('track');

        if($trackId) {
            $track = $this->trackRepo->findTrackById($trackId);
            $album_name = str_slug($track->album->name).'_'.$track->album->id;
            $filePath = storage_path('track_files/'.$album_name.'/'.$track->path);
            $mime_type = "audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3";

            return (new Response($filePath, 200))
                ->header('Content-Type', $mime_type)
                ->header('Content-length:' . filesize($filePath))
                ->header('Content-Disposition', 'filename="' . basename($filePath) . '"')
                ->header('Content-Transfer-Encoding', 'binary')
                ->header('Expires', 0)
                ->header('Cache-Control', 'no-cache')
                ->header('Pragma', 'public')
                ->header('X-Pad', 'avoid browser bug');
        }

        return 'cant find anything';
    }

can anybody has this solution? thanks

25 Mar
1 year ago

anikkhan started a new conversation How To Add Data Dynamically

I was wondering if anyone can help me with implementing the Select2 jQuery library with Laravel to add items dynamically if the item its not exists.

My Scenario each artist has multi genres, where i use manytomany relationship and used this code in [email protected] or update

$model->genres()->sync($request->input('genre_list'));

so i want implement if the genre not exists then create one.

Thank you guys.

22 Mar
1 year ago

anikkhan left a reply on Vue Route

how to i order?

I created one route file for backend.php in route folder, Then set in RouteServiceProvider

/**
     * Define the routes for the application.
     *
     * @return void
     */
    public function map()
    {
        $this->mapApiRoutes();

        $this->mapWebRoutes();

        $this->mapBackendRoutes();

    }

    /**
     * Define the "web" routes for the application.
     *
     * These routes all receive session state, CSRF protection, etc.
     *
     * @return void
     */
    protected function mapWebRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    }

    protected function mapBackendRoutes()
    {
        Route::prefix('backend')
            ->middleware('web')
            ->namespace($this->namespace)
            ->group(base_path('routes/backend.php'));
    }

    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::prefix('api')
             ->middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));
    }

I do not have any admin panel relation in vue route. i just want to write in browser mydomain.com/backend, which will take me the admin panel.

here i my vue route

import Route from 'vue-routisan';
import { auth, guest } from './guards';

Route.view('/', 'Home');

Route.group({ guard: guest }, () => {
    Route.view('/signup', 'Auth/Signup');
    Route.view('/signin', 'Auth/Signin');
    // Route.view('/password/reset', 'Auth/Passwords/Email');
    // Route.view('/password/reset/:token', 'Auth/Passwords/Reset');
});

Route.view('*', 'Errors/404');

export default Route.all();

Thank you for your time.

anikkhan started a new conversation Vue Route

Hey guys, i want know is there anyway i can redirect to my admin panel?

I use vue for my frontend and i admin panel i use laravel blade.

i have set admin panel route as /admin, but its doesn't route because i use vue route.

is there any way i can route admin panel?

Thank you

18 Mar
1 year ago

anikkhan started a new conversation .mp3 File Uploading Convert To .mpga

Hey guys, if i upload mp3 file, why its auto convert to .mpga file?

here is my code

public function addTrack($id, Request $request)
    {
        $this->validate($request, [
            'files' => 'required'
        ]);

        $album = $this->albumRepo->findAlbumById($id);
        $files = $request->file('files');

        if($request->hasFile('files')) {
            $getid3 = new \getID3();

            foreach ($files as $key => $file) {


                $file_name = preg_replace('/\.[^.\s]{3,4}$/', '', $file->getClientOriginalName());
                $extension = $file->getClientOriginalExtension();
                $albumName = str_slug($album->name).'_'.$album->id;
                $path = $file->store('track_files/'.$albumName);

                $analyze = $getid3->analyze($path);

                $album->tracks()->create([
                    'name' => $file_name,
                    'slug' => str_slug($file_name),
                    'number' => ++$key,
                    'popularity' => 50,
                    'path' => $path,
//                    'duration' => $analyze['bitrate'],
//                    'playtime' => $analyze['playtime_string'],
                ]);
            }
        }

        return redirect()->back()->with('message', trans('store'));
    }

Thank you

11 Mar
1 year ago

anikkhan left a reply on How Do I Get Similar Products

let me tell you what i exactly doing

Method

public function similarArtist()
   {
       //get the artist
      $artist = Artist::with('genres')->findOrFail(1);

      $genreIds = $artist->genres->pluck('id')->toArray();

      $similarArtists = Artist::whereHas('genres', function ($query) use ($genreIds) {
          return $query->whereIn('id', $genreIds);
      })->whereNot('id', $artist->id)
          ->limit(10)
          ->get();

      return $similarArtists;
   }

Model

public function genres() { return $this->belongsToMany('App\Genre', 'genre_artist'); }

Now i try to get similar artist whos artist are using genres.

anikkhan left a reply on How Do I Get Similar Products

Yes i used belongsToMany and

Getting strtolower() expects parameter 1 to be string, object given error

anikkhan started a new conversation How Do I Get Similar Products

Hello guys, How do i get Similar Products from categories;

Ex: if i go to single product page i want to show similar product using same category, but each product has multiply categories.

17 Sep
1 year ago

anikkhan started a new conversation Upload Multiple Files

Hi, I am having some problem with upload multiple files. I uploaded multi files and my database its show the current number and its look good but in the file path its doesn't show all the file just only 2 files if i upload more then 2 .

here is my controller ''' public function postUploadImages(Request $request, Page $page) { // $this->validate($request, [ // 'path' => 'required|image|mimes:jpeg,bmp,png' // ]);

    if($request->hasFile('path')){
        $path = public_path(). '/uploads/images/';
        $files = $request->file('path');

        if($files[0] != ''){
            foreach ($files as $file){
                if (!File::exists($path)) File::makeDirectory($path, 0775, true);
                $name = md5(Carbon::now()). '.' . $file->getClientOriginalExtension();
                $file->move($path, $name);

                $image = new Image();
                $image->path = $name;
                $image->page_id = $page->id;
                $image->save();
            }
        }
    }

    return redirect()->route('backend.pages.image', $page)->with('success', 'Successfully upload Image');
}

''' Thank you

25 Aug
1 year ago

anikkhan started a new conversation Ype Error: Argument 1 Passed To App\Services\Paginate\Paginate::__construct()

Hey guys i need help why i am getting this error

Type error: Argument 1 passed to App\Services\Paginate\Paginate::__construct() must be an instance of Illuminate\Database\Eloquent\Builder, instance of Illuminate\Database\Eloquent\Collection given, called in /Users/saifulazam/Projects/music-app/app/Http/Controllers/Api/GenreController.php on line 23

GenreController.php
'''
class GenreController extends ApiController
{
    public function __construct(GenreTransformer $transformer)
    {
        $this->transformer = $transformer;

        $this->middleware('auth.api:optional')->only(['index', 'show']);
    }

    public function index()
    {

        $genres = new Paginate(Genre::all());

        return $this->respondWithPagination($genres);
    }
}

Paginate.php
'''
class Paginate
{
    /**
     * Total count of the items.
     *
     * @var int
     */
    protected $total;
    /**
     * Collection of items.
     *
     * @var \Illuminate\Support\Collection
     */
    protected $data;
    /**
     * Paginate constructor.
     *
     * @param \Illuminate\Database\Eloquent\Builder $builder
     * @param int $limit
     * @param int $offset
     */
    public function __construct(Builder $builder, $limit = 20, $offset = 0)
    {
        $limit = request()->get('limit', $limit);
        $offset = request()->get('offset', $offset);
        $this->total = $builder->count();
        $this->data = $builder->latest()->skip($offset)->take($limit)->get();
    }
    /**
     * Get the total count of the items.
     *
     * @return int
     */
    public function getTotal()
    {
        return $this->total;
    }
    /**
     * Get the paginated collection of items.
     *
     * @return \Illuminate\Support\Collection
     */
    public function getData()
    {
        return $this->data;
    }


Please help fix this issue. Thank you

10 Jan
2 years ago

anikkhan started a new conversation Need Help With Multi Auth

Hi, I need Help with Laravel 5.3 Multi Auth. I made second Auth which i called "Owner" I can successfully Logined in and Logout but the problem is When i logout its still she the User Name in the top Navbar.

I did all the setting in "config/auth.php"

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Defaults
    |--------------------------------------------------------------------------
    |
    | This option controls the default authentication "guard" and password
    | reset options for your application. You may change these defaults
    | as required, but they're a perfect start for most applications.
    |
    */

    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],

    /*
    |--------------------------------------------------------------------------
    | Authentication Guards
    |--------------------------------------------------------------------------
    |
    | Next, you may define every authentication guard for your application.
    | Of course, a great default configuration has been defined for you
    | here which uses session storage and the Eloquent user provider.
    |
    | All authentication drivers have a user provider. This defines how the
    | users are actually retrieved out of your database or other storage
    | mechanisms used by this application to persist your user's data.
    |
    | Supported: "session", "token"
    |
    */

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],
        'owner' => [
            'driver' => 'session',
            'provider' => 'owner',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | User Providers
    |--------------------------------------------------------------------------
    |
    | All authentication drivers have a user provider. This defines how the
    | users are actually retrieved out of your database or other storage
    | mechanisms used by this application to persist your user's data.
    |
    | If you have multiple user tables or models you may configure multiple
    | sources which represent each model / table. These sources may then
    | be assigned to any extra authentication guards you have defined.
    |
    | Supported: "database", "eloquent"
    |
    */

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],
        'owner' => [
            'driver' => 'eloquent',
            'model' => App\Models\Owner::class,
        ],

        // 'users' => [
        //     'driver' => 'database',
        //     'table' => 'users',
        // ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Resetting Passwords
    |--------------------------------------------------------------------------
    |
    | You may specify multiple password reset configurations if you have more
    | than one user table or model in the application and you want to have
    | separate password reset settings based on the specific user types.
    |
    | The expire time is the number of minutes that the reset token should be
    | considered valid. This security feature keeps tokens short-lived so
    | they have less time to be guessed. You may change this as needed.
    |
    */

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
        ],
        'owner' => [
            'provider' => 'owner',
            'table' => 'password_resets',
            'expire' => 60,
          ],
    ],

];

and in View i call like this: "{{Auth::guard('owner')->user()->fullName()}}"

Did i missed any settings?

Thank you!

01 Dec
2 years ago

anikkhan started a new conversation Similar Artist Function

Hey guys, I need Suggestion.

How do i get similar artist and automatically display in artist frontend page? Ex: I want to get similar artist if other artist has the same genres.

My migration has designed like this.

Genres: 1. id, 2. name

Artists: 1.id 2.name

genre_artist: 1.id, 2.artist_id 3.genre_id

similar_artist: 1.id, 2.artist_id, 3.similar_id

Note: When i create a artist, Its will automatically add similar artist if the create artist same genre.

25 Oct
2 years ago

anikkhan left a reply on Trying To Get Property Of Non-object

Thanks @will.wilson its work. now can you help me with something else

i want after email confirmed i want auto login and redirect to some other route?

my email confirmed method this

public function emailConfirm($token)
    {
        $user = User::whereToken($token)->firstOrFail()->confirmEmail();

        return redirect(url('/advance-prosses'))
    } 

currently after email confirmed its go to login route to login.

Thanks 

anikkhan left a reply on Trying To Get Property Of Non-object

i am still getting same error after i use you code

public function activate($token)
    {
        $user = Auth::user();

        if($user->activated){
            if ($user->activated) {
                return redirect(url('/home'))
                ->with('status', 'success')
                ->with('message', 'Your email is already activated.');
            }
            $activation = Activation::where('token', $token)
                ->where('user_id', $user->id)
                ->first();

            if (empty($activation)) {
                return redirect(url('/activate'))
                ->with('status', 'wrong')
                ->with('message', 'No such token in the database!');
            }

            $user->activated = true;
            $user->save();
            $activation->delete();

        }
    }

anikkhan started a new conversation Trying To Get Property Of Non-object

Hey i am getting this error "Trying to get property of non-object" in my controller

my Controller

 public function activate($token)
    {
        if (Auth::user()->activated) {
            return redirect()->route('public.home')
                ->with('status', 'success')
                ->with('message', 'Your email is already activated.');
        }
        $activation = Activation::where('token', $token)
            ->where('user_id', auth()->user()->id)
            ->first();
        if (empty($activation)) {
            return redirect()->route('public.home')
                ->with('status', 'wrong')
                ->with('message', 'No such token in the database!');
        }
        auth()->user()->activated = true;
        auth()->user()->save();
        $activation->delete();
        session()->forget('above-navbar-message');
        return redirect()->route('public.home')
            ->with('status', 'success')
            ->with('message', 'You successfully activated your email!');
    }
19 Oct
2 years ago

anikkhan left a reply on How To Send Welcom Emall.

If i use welcome email in postSignUp method, its will send to email at same time which email confirmation and welcome email. but i want after email confirmation successful then send welcome email.

18 Oct
2 years ago

anikkhan started a new conversation How To Send Welcom Emall.

Hello Guys, Any body have any idea how to send welcome email after register. I have setup my application as a activate email register which i have done and its successfully work but i want after a user activate account i want send a welcome email to them.

but i stock on it. can some one help me Thank you

class RegisterController extends Controller
{

    public function __construct()
    {
        $this->middleware('guest');
    }


    public function index()
    {
        return view('auth.register');
    }


    public function postSignUp(Request $request, RegisterEmailConfirmation $confirmation)
    {
        $this->validate($request, [
            'first_name' => 'required|max:50',
            'last_name' => 'required|max:50',
            'email' => 'required|email|unique:users',
            'password' => 'required|confirmed|min:6'
        ]);

        $user = User::create($request->all());

        $confirmation->sendEmailConfirmationTo($user);

        alert()->info('Please confirm your Email address.')->persistent('Close')->autoclose(3500);

        return redirect('/');
    }

    public function emailConfirm($token)
    {
        User::whereToken($token)->firstOrFail()->confirmEmail();

        alert()->success('You are now confirmed. Please Login.')->persistent('Close');

        return redirect('sign-in');
    }


}

30 Sep
2 years ago

anikkhan left a reply on How Do I Call All Item Where User_id=1,2,3,4?

Thank you all of you guys.

anikkhan left a reply on How Do I Call All Item Where User_id=1,2,3,4?

Sorry i ask wrong question. I meant to say Call all item from item table where posted by user form users table, Using user_item table.

anikkhan started a new conversation How Do I Call All Item Where User_id=1,2,3,4?

Hey Guys, I need help. How do i call all item where user_id=1,2,3,4?

EX: I wanna call item only specific some user ids.

I User Many to many relationship with user model and pivot.

Thank You

11 Sep
2 years ago

anikkhan left a reply on IndexSizeError: DOM Exception 1: Index Or Size Was Negative, Or Greater Than The Allowed Value.

Hey, I checked it, but i found is i thing something wrong TrackController or server, Because when i directly the tack route which is "http://domain.com/track/168656/mp3/stream" its work on all browser except safari. im getting error "Failed to load resource: Plug-in handled load" . so it not have any frontend javascript relationship. it should get mp3 file on browser

please see the snapshot of route:

Safari: https://drive.google.com/open?id=0BwCpWfVn8z59MDlZcmk3eVgwUm8 Firefox: https://drive.google.com/open?id=0BwCpWfVn8z59emNONm1WSEtTNzg

Thanks

10 Sep
2 years ago

anikkhan started a new conversation IndexSizeError: DOM Exception 1: Index Or Size Was Negative, Or Greater Than The Allowed Value.

Hey guys, I really need help. I have a music application, The music streaming work fine in Firefox and chrome browser but Safari its not streaming. i don't know why but i getting this error in safari browser console "IndexSizeError: DOM Exception 1: Index or size was negative, or greater than the allowed value." Please Any body can help with this issue. Here is my stream controller

/**
     * Find track matching given id.
     *
     * @param int    $id
     * @oaram string $mime
     * @return Track
     */
    public function stream($id, $mime)
    {
        $track = Track::findOrFail($id);
        $path  = $this->customUploads->getCustomTrackFilePath($track, true);

        $size   = Storage::size($path);
        $time   = date('r', Storage::lastModified($path));
        $fm     = Storage::getDriver()->readStream($path);
        $begin  = 0;
        $end    = $size - 1;

        if (isset($_SERVER['HTTP_RANGE']))
        {
            if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches))
            {
                $begin  = intval($matches[1]);
                if (!empty($matches[2]))
                {
                    $end = intval($matches[2]);
                }
            }
        }

        if (isset($_SERVER['HTTP_RANGE']))
        {
            header('HTTP/1.1 206 Partial Content');
        }
        else
        {
            header('HTTP/1.1 200 OK');
        }

        header("Content-Type: $mime");
        header('Cache-Control: public, must-revalidate, max-age=0');
        header('Pragma: no-cache');
        header('Accept-Ranges: bytes');
        header('Content-Length:' . (($end - $begin) + 1));
        if (isset($_SERVER['HTTP_RANGE']))
        {
            header("Content-Range: bytes $begin-$end/$size");
        }
        header("Content-Disposition: inline; filename=$track->name");
        header("Content-Transfer-Encoding: binary");
        header("Last-Modified: $time");

        $cur    = $begin;
        fseek($fm, $begin, 0);

        while(!feof($fm) && $cur <= $end && (connection_status() == 0))
        {
            print fread($fm, min(1024 * 16, ($end - $cur) + 1));
            $cur += 1024 * 16;
        }
    }
04 Jul
3 years ago

anikkhan started a new conversation Connection Could Not Be Established With Host Smtp.gmail.com [Connection Timed Out #110]

Hey i am getting this error. I don't know why i look up every solution still it not work can any body help me please. Error:

Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host smtp.gmail.com [Connection timed out #110]

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=mypassword MAIL_ENCRYPTION=tls

 public function postContact()
    {
        $data = Input::all();

        //Validation rules
        $rules = array(
            'first_name' => 'required',
            'last_name' => 'required',
            'phone' => 'required|numeric|min:10',
            'email' => 'required|email',
            'subject' => 'required',
            'message' => 'required'
        );

        //Validate data
        $validator = Validator::make($data, $rules);

        if($validator->passes()){
            Mail::send('emails.hello', $data, function($message) use ($data){
               $message->from($data['email'], $data['first_name'], $data['last_name']);
                $message->to('[email protected]', 'Admin Name')->subject($data['subject']);
            });

            return redirect(url('/'));
        } else {
            return Redirect::to('/contact-us')->withErrors($validator);
        }
    }
06 Apr
3 years ago

anikkhan started a new conversation Need Help Please

Hello guys i need some suggestion. My Modules are

  1. Driver
  2. Vehicle Relationship driver _vehicle i have done all migrations, model and controller but i want to know how i start coding and which way the best. What i want.
  3. when i assign a vehicle to driver, i want its will show list which vehicle are not taken.
  4. the vehicle Which will show driver profile
  5. In vehicle table which will show its taken or not

here is my migration

Schema::create('vehicle', function (Blueprint $table) {
            $table->increments('id');
            $table->string('make');
            $table->string('model');
            $table->string('year');
            $table->string('license_plate_number');
            $table->string('license_plate_state');
            $table->date('vehicle_registration_expires')->nullable();
            $table->string('vehicle_registration_docs')->nullable();
            $table->date('vehicle_inspection_expires')->nullable();
            $table->string('vehicle_inspection_docs')->nullable();
            $table->string('car_avatar')->nullable();
            $table->timestamps();
        });

Schema::create('driver', function (Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('mid_name')->nullable(); $table->string('address1'); $table->string('address2')->nullable(); $table->string('city'); $table->string('state'); $table->string('zip'); $table->string('email')->nullable(); $table->string('phone_number'); $table->string('avatar')->nullable(); $table->double('price'); $table->enum('payment_method', ['dally', 'weekly', 'monthly']); $table->enum('status', ['actived', 'inactive']); $table->string('dmv_license_number'); $table->date('dmv_license_expires'); $table->string('dmv_license_image'); $table->string('tlc_license_number'); $table->date('tlc_license_expires'); $table->string('tlc_license_image'); $table->string('fh1_insurance_certificate'); $table->date('fh1_insurance_expires'); $table->string('certificate_of_liability_insurance'); $table->string('certificate_of_liability_expires'); $table->date('dob')->nullable(); $table->date('start_date'); $table->enum('gender', ['male', 'women']); $table->timestamps(); });

Schema::create('driver_vehicle', function (Blueprint $table) {
            $table->integer('driver_id')->unsigned();
            $table->integer('vehicle_id')->unsigned();
            $table->foreign('driver_id')->references('id')->on('driver');
            $table->foreign('vehicle_id')->references('id')->on('vehicle');
        });






24 Dec
3 years ago

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

Hey I try to upload file but im getting this error "Call to a member function getClientOriginalExtension() on a non-object"

public function add(){
        $file = Request::file('file');
        $extension = $file->getClientOriginalExtension();
        Storage::disk('local')->put($file->getFilename().'.'.$extension, File::get($file));

        $entry = new \App\File();
        $entry->mime = $file->getClientMimeType();
        $entry->original_filename = $file->getClientOriginalName();
        $entry->filename = $file->getFilename().'.'.$extension;
        $entry->save();

        $product = new Product();
        $product->file_id=$entry->id;
        $product->name=Request::input('name');
        $product->description=Request::input('description');
        $product->price=Request::input('price');
        $product->imageurl=Request::input('imageurl');
        $product->save();

        return redirect('/products');
    }

01 Dec
3 years ago

anikkhan started a new conversation [Symfony\Component\Debug\Exception\FatalErrorException]

I having this issue for long time: couldn't fix yet, and this is make big issue in project can't even move to anywhere. issue is when i try to run php artisan migrate, php artisan migrate:refresh, php artisan migrate:rollback its give me this error but i have CreatePagesTable file in migration folder. please help me. Thank you

root@exceed:/var/www/root# php artisan migrate:refresh
PHP Fatal error:  Class 'CreatePagesTable' not found in /var/www/site.com/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 324
                                                         
  [Symfony\Component\Debug\Exception\FatalErrorException]  
  Class 'CreatePagesTable' not found                       
                                                           

28 Nov
3 years ago

anikkhan left a reply on Laravel File Upload

Thank you

anikkhan started a new conversation Laravel File Upload

Hey, i been try to upload a file but its not uploading and also its not saving to the data

Here is my code

Controller ''' public function update(profileRequest $request, $username) {

    $user = User::whereUsername($username)->firstOrFail();

    $user->profile->title = $request->get('title');
    $user->profile->bio = $request->get('bio');
    $user->profile->location = $request->get('location');
    $user->profile->phone_number = $request->get('phone_number');
    $user->profile->twitter = $request->get('twitter');
    $user->profile->github = $request->get('github');
    $user->profile->facebook = $request->get('facebook');
    $user->profile->google = $request->get('google');
    $user->profile->linkedin = $request->get('linkedin');
   //$user->profile->avatar = $this->createAvatar($image);
    $user->profile->avatar = $this->updateAvatar($request->get('avatar'));
    $user->profile->save();

    Flash::success('Successfully updated your profile');

    return Redirect::back();
}


public function updateAvatar($image){
    $fileName = date('y-m-d-H:i:s')."-".$image->getClientOrginalName();
    $path = public_path('/assets/uploads/users/'.$fileName);
    Image::make($image->getRealPath())->resize(263, 263)->save($path);
}

''' if i update all data with out Avatar line, its work but with with the Avatar its not working. please help.

05 Oct
3 years ago

anikkhan left a reply on Invalid Argument Supplied For Foreach()

No body has any solution?

04 Oct
3 years ago

anikkhan started a new conversation Invalid Argument Supplied For Foreach()

Hey i try to following the ACL in Laravel: Roles and Permissions Video

I did everything whatever jeff_way did but i am getting this error

Invalid argument supplied for foreach() (View: /Applications/MAMP/htdocs/webapp/resources/views/genres/create.blade.php)

Create.blade.php

@extends('layout.app')
@section('title', 'Add Genre')

@section('content')

    @can('add_genre')
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <div class="panel panel-login">
                <div class="panel-heading">
                    <div class="row">
                        <h1>Create Genre</h1>
                    </div>
                    <hr>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
                            @if (count($errors) > 0)
                                <div class="alert alert-danger">
                                    <button type="button" class="close"><span>×</span></button>
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            <form id="login-form" action="/genre" method="post" role="form" style="display: block;">
                                {{ csrf_field() }}
                                <div class="form-group">
                                    <div class="input-group margin-bottom-sm">
                                        <span class="input-group-addon"><i class="fa fa-envelope-o fa-fw"></i></span>
                                        <input type="text" name="name" id="name" tabindex="1" class="form-control" placeholder="Genre Name" value="{{ old('name') }}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group margin-bottom-sm">
                                        <span class="input-group-addon"><i class="fa fa-envelope-o fa-fw"></i></span>
                                        <input type="text" name="slug" id="slug" tabindex="1" class="form-control" placeholder="Genre Slug" value="{{ old('slug') }}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="row">
                                        <div class="col-sm-6 col-sm-offset-3">
                                            <input type="submit" id="submit" tabindex="4" class="form-control btn btn-login" value="Create">
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @else
        <h2 class="alert alert-danger">You don't have permisstion</h2>
    @endcan

@stop

AuthServiceProvider.php

<?php

namespace App\Providers;

use App\User;
use App\Permission;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any application authentication / authorization services.
     *
     * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
     * @return void
     */
    public function boot(GateContract $gate)
    {
        parent::registerPolicies($gate);

        foreach ($this->getPermissions() as $permission){

            $gate->define($permission->name, function ($user) use ($permission){
               return $user->hasRole($permission->roles);
            });
        }
    }

//    protected function getPermission(){
//
//        return Permission::with('roles')->get();
//    }


     protected function getPermissions(){
         try{
             return Permission::with('roles')->get();
         } catch (\Exception $e){
             return [];
         }
     }
}

User.php

<?php

namespace App;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name', 'email', 'password', 'first_name', 'last_name', 'avatar', 'description', 'twitter', 'facebook'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['password', 'remember_token'];

    public function roles(){

        return $this->belongsToMany(Role::class);
    }

    public function assignRole($role){

        return $this->roles()->sync(Role::whereName($role)->firstOrFail());
    }

    public function hasRole($role){

        if (is_string($role)){
            return $this->roles()->contains('name', $role);
        }

        return !! $role->intersect($this->roles()->count());

//      foreach ($role as $r){
//          if ($this->hasRole($r->name)){
//              return true;
//          }
//      }
    }
}

permission.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Permission extends Model
{
    protected $table = "permissions";

    public function roles(){
        return $this->belongsToMany(Role::class);
    }
}

Role.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    public function permissions(){

        return $this->belongsToMany(Permission::class);
    }

    public function givePermissionTo(Permission $permission){

        return $this->permissions()->save($permission);
    }
}

Please can anybody help me Thank you

11 Sep
3 years ago

anikkhan started a new conversation Missing Argument 1

Hey guys i am getting this error.

Missing argument 1 for App\Http\Controllers\DashboardController::show()

DashboardController::show

public function show($id)
    {
       $user = User::findOrNew($id);
        return $user;
    }

Route

Route::get('profile', [
    'middleware' => 'auth',
    'uses' => 'DashboardController@show'
]);

anikkhan left a reply on Login And Register Dosen't Work

thank you guys its work :)

anikkhan left a reply on Login And Register Dosen't Work

Thank you for your reply, i change it now i got this please see the screenshot https://copy.com/fh6hbPNIzJrhwWx0

and also when i click register its show this error.

TokenMismatchException in VerifyCsrfToken.php line 53:

new Register code

@extends('layout.app')
@section('title', 'Register')

@section('content')
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <div class="panel panel-login">
                <div class="panel-heading">
                    <div class="row">
                        <h1>Register</h1>
                    </div>
                    <hr>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
                            @if (count($errors) > 0)
                                <div class="alert alert-danger">
                                    <button type="button" class="close"><span>×</span></button>
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            // Remove the spaces between the curly braces
                                            <li>{ { $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            <form id="login-form" action="/auth/register" method="post" role="form" style="display: block;">
                                {{ csrf_token() }}
                                <div class="form-group">
                                    <input type="text" name="username" id="name" tabindex="1" class="form-control" placeholder="Name" value="{{ old('username') }}">
                                </div>
                                <div class="form-group">
                                    <input type="text" name="email" id="email" tabindex="1" class="form-control" placeholder="Email" value="{{ old('email') }}">
                                </div>
                                <div class="form-group">
                                    <input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
                                </div>
                                <div class="form-group">
                                    <input type="password" name="password_confirmation" id="password" tabindex="2" class="form-control" placeholder="Password">
                                </div>
                                <div class="form-group">
                                    <div class="row">
                                        <div class="col-sm-6 col-sm-offset-3">
                                            <input type="submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="text-center">
                                                <a href="http://phpoll.com/recover" tabindex="5" class="forgot-password">Forgot Password?</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@stop

anikkhan started a new conversation Login And Register Dosen't Work

Hey guys i don't know what is wrong with my code. i try to make Login and register view using laravel factory auth but when i click register or login its come to same page and i check in database no any data there.

Route

// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

register.blade

@extends('layout.app')
@section('title', 'Register')

@section('content')
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <div class="panel panel-login">
                <div class="panel-heading">
                    <div class="row">
                        <h1>Register</h1>
                    </div>
                    <hr>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <form id="login-form" action="/auth/register" method="post" role="form" style="display: block;">
                                {{ csrf_field() }}
                                <div class="form-group">
                                    <input type="text" name="username" id="name" tabindex="1" class="form-control" placeholder="Name" value="{{ old('username') }}">
                                </div>
                                <div class="form-group">
                                    <input type="text" name="email" id="email" tabindex="1" class="form-control" placeholder="Email" value="{{ old('email') }}">
                                </div>
                                <div class="form-group">
                                    <input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
                                </div>
                                <div class="form-group">
                                    <input type="password" name="password_confirmation" id="password" tabindex="2" class="form-control" placeholder="Password">
                                </div>
                                <div class="form-group">
                                    <div class="row">
                                        <div class="col-sm-6 col-sm-offset-3">
                                            <input type="submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="text-center">
                                                <a href="http://phpoll.com/recover" tabindex="5" class="forgot-password">Forgot Password?</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@stop````
03 Sep
3 years ago

anikkhan started a new conversation Need Help On Angularjs

Hey Guys, anybody can give me any example code for Slug using angularjs

i have success for getting all from database but now i stock on do slug here is my code

angularjs Code

var app = angular.module('genreApp', [], function($interpolateProvider){
    $interpolateProvider.startSymbol('<%');
    $interpolateProvider.endSymbol('%>');
});

app.controller('genresController', function($scope, $http){
    $scope.genres = [];
    $scope.loading = false;

    $scope.init = function(){
        $scope.loading = true;
        $http.get('/api/genres').success(function(data, status, headers, config){
            $scope.genres = data;
            $scope.loading = false;
        });
    };
    
    // genre slug code

    $scope.init();
});

and also give view code as will Please

20 Aug
3 years ago

anikkhan left a reply on SQLSTATE[23000]: Integrity Constraint Violation

one question

How do i select multiple Genres in Artists create?

19 Aug
3 years ago

anikkhan left a reply on SQLSTATE[23000]: Integrity Constraint Violation

Thank you to all for help, thanks to @veve286 and @hadjidoro

anikkhan left a reply on Hello Guys I Really Need Help

how i can edit the title @olimorris @hadjidoro yes

Artists public function up() { Schema::create('artists', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('slug'); $table->string('website'); $table->string('image'); $table->longText('bio'); $table->integer('genre_id')->unsigned(); $table->foreign('genre_id')->references('id')->on('genres'); $table->timestamps(); }); }

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::drop('artists');
}

Genres public function up() { Schema::create('Genres', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('slug'); $table->text('description'); $table->string('image'); $table->timestamps(); }); }

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::drop('Genres');
}

anikkhan left a reply on Hello Guys I Really Need Help

After i changing Artists::create([ 'name' => $request->get('name'), 'slug' => $request->get('slug'), 'website' => $request->get('website'), 'bio' => $request->get('bio'), 'genre_id' => $request->get('genre_id'), 'image' => $this->createImage($image) ]);

i got this error

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (laravel_finalapp.artists, CONSTRAINT artists_genre_id_foreign FOREIGN KEY (genre_id) REFERENCES genres (id)) (SQL: insert into artists (name, slug, image, updated_at, created_at) values (Habib Wahid, habib-wahid, /assets/artists/987005f5a3fdbf1637a8692c60a19e0f8c50baf7.jpeg, 2015-08-20 00:11:12, 2015-08-20 00:11:12))

anikkhan left a reply on Hello Guys I Really Need Help

Thank you for reply me. Now i am getting this error:

Undefined property: Illuminate\Database\Eloquent\Collection::$POST /artists HTTP/1.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.5 Cache-Control: max-age=0 Connection: keep-alive Content-Length: 32525 Content-Type: multipart/form-data; boundary=---------------------------16814570421511194021348817878 Cookie: XSRF-TOKEN=eyJpdiI6IlZjWmxZNVFQbDNDVVV3bGpWdUJVQnc9PSIsInZhbHVlIjoiR2VjSURWY2szZ1Bjck05Z1NGYnM0RFY4M1FNUDJEbmhSSFRydWdXbmdON0EzZldXTEgzSGFjbWl5TU10UzBiTkJzTUg1MkxNdzlZWTI2c2FjK2pac0E9PSIsIm1hYyI6Ijg3OWQzMzdhNTExNWZkZGNmNDNlNzRiMGZmYjYzOTMwOWE4ZGFlNzNkNWIwZWJkOGRkMjMwN2M1ZjM4ZjBlYjAifQ%3D%3D; laravel_session=eyJpdiI6IkY4SkhrUHRtbEgzaEZBSGdEQzFyaVE9PSIsInZhbHVlIjoiVGVKTXV1dDd1YU9xdEZXNjQxZnBOY1pldldqVlhiSU5WdWtsekh3R0xtMG5UMTFLTnN5cklZVXFmMmowSVpHOW5KckJZMjJuY1A2TlEzaVlhZDMyaGc9PSIsIm1hYyI6IjJlY2QxZTAyZTdiZWUyM2JlNWY3OTg5YTc3NDU1MzkxZDg0ZmRiMGFiNmFjZTEzN2JiODEwMDBiNTc5YjAwNDkifQ%3D%3D Host: finalapp:8888 Referer: http://finalapp:8888/artists/create User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:32.0) Gecko/20100101 Firefox/32.0

anikkhan started a new conversation Hello Guys I Really Need Help

I try to to make a music apps using laravel 5.1 step by step my first step is Genre and 2nd step Artists

In my artist create page where i have select Genres. but when i try to submit artist its saying "The genre id field is required."

i don't know how to i fix it .

Artist table Schema::create('artists', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('slug'); $table->string('website'); $table->string('image'); $table->longText('bio'); $table->integer('genre_id')->unsigned(); $table->foreign('genre_id')->references('id')->on('genres'); $table->timestamps(); });

Artists Model

class Artists extends Model { protected $fillable = ['name', 'slug', 'image', ];

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

}

Genres Model class Genres extends Model { protected $fillable = ['name', 'slug', 'image'];

public function artists(){
    return $this->belongsTo('App\Artists');
}

Artists Controller class ArtistsController extends Controller { /** * Display a listing of the resource. * * @return Response */ public function index() { // }

/**
 * Show the form for creating a new resource.
 *
 * @return Response
 */
public function create()
{
    $title = 'Create Artist';
    return view('artists.create', compact('title'));
}

/**
 * Store a newly created resource in storage.
 *
 * @param  Request  $request
 * @return Response
 */
public function store(ArtistsRequest $request)
{
    $genres = Genres::all();
    $image = $request->file('image');

    Artists::create([
        'name' => $request->get('name'),
        'slug' => $request->get('slug'),
        'website' => $request->get('website'),
        'bio'  => $request->get('bio'),
        'genre_id' => $genres->$request->get('genre_id'),
        'image' => $this->createImage($image)
    ]);

    return redirect('/artists')->with(['artist_created' => 'Artist Successfully Added!']);
}

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
public function show($id)
{
    //
}

/**
 * Show the form for editing the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
public function edit($id)
{
    //
}

/**
 * Update the specified resource in storage.
 *
 * @param  Request  $request
 * @param  int  $id
 * @return Response
 */
public function update(Request $request, $id)
{
    //
}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return Response
 */
public function destroy($id)
{
    //
}

public function createImage($image){
    $path = '/assets/artists/';
    $name = sha1(Carbon::now()).'.'.$image->guessExtension();
    $image->move(getcwd().$path, $name);
    return $path.$name;
}

Genres Controller

class GenresController extends Controller { /** * Display a listing of the resource. * * @return Response */ public function index() { $genres = Genres::all(); return view('genres.index', compact('genres')); }

/**
 * Show the form for creating a new resource.
 *
 * @return Response
 */
public function create()
{
    $title = 'Create Genre';
    return view('genres.create', compact('title'));
}

/**
 * Store a newly created resource in storage.
 *
 * @param  Request  $request
 * @return Response
 */
public function store(GenresRequest $request)
{
    $image = $request->file('image');
    Genres::create([
        'name' => $request->get('name'),
        'slug' => $request->get('slug'),
        'image' => $this->createImage($image)
    ]);

    return redirect('/genres')->with(['genre_created' => 'Genre Successfully Added!']);
}

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
public function show($slug)
{
    $genre = Genres::where('slug', '=', $slug)->firstOrFail();
    return view('genres.show', compact('genre'));

}

/**
 * Show the form for editing the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
public function edit($id)
{
    //
}

/**
 * Update the specified resource in storage.
 *
 * @param  Request  $request
 * @param  int  $id
 * @return Response
 */
public function update(Request $request, $id)
{
    //
}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return Response
 */
public function destroy($id)
{
    Genres::destroy($id);
}

public function createImage($image){
    $path = '/assets/genres/';
    $name = sha1(Carbon::now()).'.'.$image->guessExtension();
    $image->move(getcwd().$path, $name);
    return $path.$name;
}

and Artists Create view @extends('layout.main') @section('title', 'Create Artist')

@section('contain')

<div class="container">
    <h1>Create Artist</h1>
    <hr>
    <div class="row">
        <form method="post" action="/artists" class="col-md-6" enctype="multipart/form-data">
            {{ csrf_field() }}
            @if(count($errors) > 0)
                <div class="alert alert-danger">
                    <ul>
                        @foreach($errors->all() as $error)
                            <li>{{$error}}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
            <div class="form-group">
                <label for="name">Name:</label>
                <input type="text" name="name" id="name" class="form-control" value="{{ old('name') }}">
            </div>
            <div class="form-group">
                <label for="slug">Slug:</label>
                <input type="text" name="slug" id="slug" class="form-control" value="{{ old('slug') }}">
            </div>
            <div class="form-group">
                <label for="image">Upload Image:</label>
                <input type="file" name="image" id="image" class="form-control" value="{{ old('image') }}">
            </div>
            <div class="form-group">
                <label for="website">Website:</label>
                <input type="text" name="website" id="website" class="form-control" value="{{ old('website') }}">
            </div>
            <div class="form-group">
                <label for="bio">Bio:</label>
                <textarea type="text" name="bio" id="bio" class="form-control" rows="10" value="{{ old('bio') }}"></textarea>
            </div>
            <div class="form-group">
                <label for="genre">Select Genre:</label>
                <select id="genre" name="genre" class="form-control" value="{{ old('genre') }}">
                    @foreach(App\Genres::all() as $genre)
                        <option value="{{ $genre->name }}">{{$genre->name}}</option>
                    @endforeach
                </select>
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Create Genre</button>
            </div>
        </form>
    </div>
</div>

@stop

Please help me Thank you

30 Jul
3 years ago

anikkhan started a new conversation New Project Suggestion

Hey guys i try to start new project which is for Music smiler like http://www.saavn.com/

Features Real full real SEO optimizer Easy to manager and config script to works Trendding songs Top songs of the week Tastemakers, Feauted album Fully ex.fm features working. Powerful HTML5 Music Player that work on iPad and mobile browsers Using smart cache to help server healthy Visitor can search music, loved music. making friend Follower and Following just work like Twitter with Feed news from following people. User profile where member of website can style himself, change background, manager loved song, ect... Registration, login with facebook and twitter account Multi-user Clean & Modern design, nice and neat interface for the fastest browsing speed. Cross-Browser compatible And many more ...

Script/Admin Features Manager album, artist, music Manager member Manager user group, admin can set permission for usergroup access admin and manager artist/album/song Genre manager Filter illegal username

Any body has any Suggestion please let me know i can start. Thank You

24 Jul
3 years ago

anikkhan left a reply on Im Getting Error

what you mean where are you trying to write the file? I use Nginx Web Server on Ubuntu 14.04

Here is the linke code where im getting errror public function put($path, $contents, $lock = false) { return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); }

Here is full file code:

use ErrorException; use FilesystemIterator; use Symfony\Component\Finder\Finder; use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Filesystem\FileNotFoundException;

class Filesystem {

use Macroable;

/**
 * Determine if a file exists.
 *
 * @param  string  $path
 * @return bool
 */
public function exists($path)
{
    return file_exists($path);
}

/**
 * Get the contents of a file.
 *
 * @param  string  $path
 * @return string
 *
 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
 */
public function get($path)
{
    if ($this->isFile($path)) return file_get_contents($path);

    throw new FileNotFoundException("File does not exist at path {$path}");
}

/**
 * Get the returned value of a file.
 *
 * @param  string  $path
 * @return mixed
 *
 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
 */
public function getRequire($path)
{
    if ($this->isFile($path)) return require $path;

    throw new FileNotFoundException("File does not exist at path {$path}");
}

/**
 * Require the given file once.
 *
 * @param  string  $file
 * @return mixed
 */
public function requireOnce($file)
{
    require_once $file;
}

/**
 * Write the contents of a file.
 *
 * @param  string  $path
 * @param  string  $contents
 * @param  bool  $lock
 * @return int
 */
public function put($path, $contents, $lock = false)
{
    return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
}

/**
 * Prepend to a file.
 *
 * @param  string  $path
 * @param  string  $data
 * @return int
 */
public function prepend($path, $data)
{
    if ($this->exists($path))
    {
        return $this->put($path, $data.$this->get($path));
    }

    return $this->put($path, $data);
}

/**
 * Append to a file.
 *
 * @param  string  $path
 * @param  string  $data
 * @return int
 */
public function append($path, $data)
{
    return file_put_contents($path, $data, FILE_APPEND);
}

/**
 * Delete the file at a given path.
 *
 * @param  string|array  $paths
 * @return bool
 */
public function delete($paths)
{
    $paths = is_array($paths) ? $paths : func_get_args();

    $success = true;

    foreach ($paths as $path)
    {
        try
        {
            if ( ! @unlink($path))
            {
                $success = false;
            }
        }
        catch (ErrorException $e)
        {
            $success = false;
        }
    }

    return $success;
}

/**
 * Move a file to a new location.
 *
 * @param  string  $path
 * @param  string  $target
 * @return bool
 */
public function move($path, $target)
{
    return rename($path, $target);
}

/**
 * Copy a file to a new location.
 *
 * @param  string  $path
 * @param  string  $target
 * @return bool
 */
public function copy($path, $target)
{
    return copy($path, $target);
}

/**
 * Extract the file name from a file path.
 *
 * @param  string  $path
 * @return string
 */
public function name($path)
{
    return pathinfo($path, PATHINFO_FILENAME);
}

/**
 * Extract the file extension from a file path.
 *
 * @param  string  $path
 * @return string
 */
public function extension($path)
{
    return pathinfo($path, PATHINFO_EXTENSION);
}

/**
 * Get the file type of a given file.
 *
 * @param  string  $path
 * @return string
 */
public function type($path)
{
    return filetype($path);
}

/**
 * Get the mime-type of a given file.
 *
 * @param  string  $path
 * @return string|false
 */
public function mimeType($path)
{
    return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
}

/**
 * Get the file size of a given file.
 *
 * @param  string  $path
 * @return int
 */
public function size($path)
{
    return filesize($path);
}

/**
 * Get the file's last modification time.
 *
 * @param  string  $path
 * @return int
 */
public function lastModified($path)
{
    return filemtime($path);
}

/**
 * Determine if the given path is a directory.
 *
 * @param  string  $directory
 * @return bool
 */
public function isDirectory($directory)
{
    return is_dir($directory);
}

/**
 * Determine if the given path is writable.
 *
 * @param  string  $path
 * @return bool
 */
public function isWritable($path)
{
    return is_writable($path);
}

/**
 * Determine if the given path is a file.
 *
 * @param  string  $file
 * @return bool
 */
public function isFile($file)
{
    return is_file($file);
}

/**
 * Find path names matching a given pattern.
 *
 * @param  string  $pattern
 * @param  int     $flags
 * @return array
 */
public function glob($pattern, $flags = 0)
{
    return glob($pattern, $flags);
}

/**
 * Get an array of all files in a directory.
 *
 * @param  string  $directory
 * @return array
 */
public function files($directory)
{
    $glob = glob($directory.'/*');

    if ($glob === false) return array();

    // To get the appropriate files, we'll simply glob the directory and filter
    // out any "files" that are not truly files so we do not end up with any
    // directories in our list, but only true files within the directory.
    return array_filter($glob, function($file)
    {
        return filetype($file) == 'file';
    });
}

/**
 * Get all of the files from the given directory (recursive).
 *
 * @param  string  $directory
 * @return array
 */
public function allFiles($directory)
{
    return iterator_to_array(Finder::create()->files()->in($directory), false);
}

/**
 * Get all of the directories within a given directory.
 *
 * @param  string  $directory
 * @return array
 */
public function directories($directory)
{
    $directories = array();

    foreach (Finder::create()->in($directory)->directories()->depth(0) as $dir)
    {
        $directories[] = $dir->getPathname();
    }

    return $directories;
}

/**
 * Create a directory.
 *
 * @param  string  $path
 * @param  int     $mode
 * @param  bool    $recursive
 * @param  bool    $force
 * @return bool
 */
public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false)
{
    if ($force)
    {
        return @mkdir($path, $mode, $recursive);
    }

    return mkdir($path, $mode, $recursive);
}

/**
 * Copy a directory from one location to another.
 *
 * @param  string  $directory
 * @param  string  $destination
 * @param  int     $options
 * @return bool
 */
public function copyDirectory($directory, $destination, $options = null)
{
    if ( ! $this->isDirectory($directory)) return false;

    $options = $options ?: FilesystemIterator::SKIP_DOTS;

    // If the destination directory does not actually exist, we will go ahead and
    // create it recursively, which just gets the destination prepared to copy
    // the files over. Once we make the directory we'll proceed the copying.
    if ( ! $this->isDirectory($destination))
    {
        $this->makeDirectory($destination, 0777, true);
    }

    $items = new FilesystemIterator($directory, $options);

    foreach ($items as $item)
    {
        // As we spin through items, we will check to see if the current file is actually
        // a directory or a file. When it is actually a directory we will need to call
        // back into this function recursively to keep copying these nested folders.
        $target = $destination.'/'.$item->getBasename();

        if ($item->isDir())
        {
            $path = $item->getPathname();

            if ( ! $this->copyDirectory($path, $target, $options)) return false;
        }

        // If the current items is just a regular file, we will just copy this to the new
        // location and keep looping. If for some reason the copy fails we'll bail out
        // and return false, so the developer is aware that the copy process failed.
        else
        {
            if ( ! $this->copy($item->getPathname(), $target)) return false;
        }
    }

    return true;
}

/**
 * Recursively delete a directory.
 *
 * The directory itself may be optionally preserved.
 *
 * @param  string  $directory
 * @param  bool    $preserve
 * @return bool
 */
public function deleteDirectory($directory, $preserve = false)
{
    if ( ! $this->isDirectory($directory)) return false;

    $items = new FilesystemIterator($directory);

    foreach ($items as $item)
    {
        // If the item is a directory, we can just recurse into the function and
        // delete that sub-directory otherwise we'll just delete the file and
        // keep iterating through each file until the directory is cleaned.
        if ($item->isDir() && ! $item->isLink())
        {
            $this->deleteDirectory($item->getPathname());
        }

        // If the item is just a file, we can go ahead and delete it since we're
        // just looping through and waxing all of the files in this directory
        // and calling directories recursively, so we delete the real path.
        else
        {
            $this->delete($item->getPathname());
        }
    }

    if ( ! $preserve) @rmdir($directory);

    return true;
}

/**
 * Empty the specified directory of all files and folders.
 *
 * @param  string  $directory
 * @return bool
 */
public function cleanDirectory($directory)
{
    return $this->deleteDirectory($directory, true);
}

}

anikkhan started a new conversation Im Getting Error

Hey guys can you tell me why i am getting this error and how to i can fix it? thank you!

ErrorException in Filesystem.php line 75: file_put_contents(/c2efa7ff7fc14f470c879645e6842fe3): failed to open stream: Permission denied

04 Jul
4 years ago

anikkhan left a reply on SQLSTATE[42000]: Error

Thanks its work

anikkhan started a new conversation SQLSTATE[42000]: Error

Hello guys i try to migrate my database but i am getting error:

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near ') default character set utf8 collate utf8_unicode_ci' at line 1 (SQL: create table users () default character set utf8 collate utf8_unico
de_ci)

[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near ') default character set utf8 collate utf8_unicode_ci' at line 1

Can body fix this problem please?