Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

redroseamit

redroseamit

Member Since 3 Months Ago

Experience Points
2,520
Total
Experience

2,480 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
18
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 1
2,520 XP
Oct
30
3 weeks ago
Activity icon

Replied to I Am Getting Error While Using Chatify Package

sir can you please prefer any good package for this... it would be great for me

Activity icon

Replied to I Am Getting Error While Using Chatify Package

this is vendor package route 

<?php
/**
 * -----------------------------------------------------------------
 * NOTE : There is two routes has a name (user & group),
 * any change in these two route's name may cause an issue
 * if not modified in all places that used in (e.g Chatify class,
 * Controllers, chatify javascript file...).
 * -----------------------------------------------------------------
 */


/*
* This is the main app route [Chatify Messenger]
*/
Route::get('/', '[email protected]')->name(config('chatify.path'));

/**
 *  Fetch info for specific id [user/group]
 */
Route::post('/idInfo', '[email protected]');

/**
 * Send message route
 */
Route::post('/sendMessage', '[email protected]')->name('send.message');

/**
 * Fetch messages 
 */
Route::post('/fetchMessages', '[email protected]')->name('fetch.messages');

/**
 * Download attachments route to create a downloadable links
 */
Route::get('/download/{fileName}', '[email protected]')->name(config('chatify.attachments.route'));

/**
 * Authintication for pusher private channels
 */
Route::post('/chat/auth', '[email protected]')->name('pusher.auth');

/**
 * Make messages as seen
 */
Route::post('/makeSeen', '[email protected]')->name('messages.seen');

/**
 * Get contacts
 */
Route::post('/getContacts', '[email protected]')->name('contacts.get');

/**
 * Update contact item data
 */
Route::post('/updateContacts', '[email protected]')->name('contacts.update');


/**
 * Star in favorite list
 */
Route::post('/star', '[email protected]')->name('star');

/**
 * get favorites list
 */
Route::post('/favorites', '[email protected]')->name('favorites');

/**
 * Search in messenger
 */
Route::post('/search', '[email protected]')->name('search');

/**
 * Get shared photos
 */
Route::post('/shared', '[email protected]')->name('shared');

/**
 * Delete Conversation
 */
Route::post('/deleteConversation', '[email protected]')->name('conversation.delete');

/**
 * Delete Conversation
 */
Route::post('/updateSettings', '[email protected]')->name('avatar.update');

/**
 * Set active status
 */
Route::post('/setActiveStatus', '[email protected]')->name('activeStatus.set');






/*
* [Group] view by id
*/
Route::get('/group/{id}', '[email protected]')->name('group');

/*
* user view by id.
* Note : If you added routes after the [User] which is the below one,
* it will considered as user id.
*
* e.g. - The commented routes below :
*/
// Route::get('/route', function(){ return 'Munaf'; }); // works as a route
Route::get('/{id}', '[email protected]')->name('user');
// Route::get('/route', function(){ return 'Munaf'; }); // works as a user id


this is main route
<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('index');
});

Route::get('/register', function () {
    return view('register');
});

Route::get('/login', function () {
    return view('login');
});


Route::get('/forget', function () {
    return view('forget');
});

Route::get('users/chat', function () {
    return view('users/chat');
});

Route::get('users/dashboard', function () {
    return view('users/dashboard');
});



Route::get('users/id', function () {
    return view('users/id');
});


Route::get('users/profile', function () {
    return view('users/profile');
});


Route::get('users/newsfeed', function () {
    return view('users/newsfeed');
});

Route::get('users/notifications', function () {
    return view('users/notifications');
});

Route::get('users/timeline', function () {
    return view('users/timeline');
});

Route::get('users/messages', function () {
    return view('users/messages');
});

Route::get('users/about', function () {
    return view('users/about');
});

Route::get('users/photos', function () {
    return view('users/photos');
});

Route::get('users/videos', function () {
    return view('users/photos');
});



Route::get('users/group', function () {
    return view('users/group');
});

Route::get('users/group-detail', function () {
    return view('users/group-detail');
});




Route::get('users/fav-page', function () {
    return view('users/fav-page');
});

Route::get('users/followers', function () {
    return view('users/followers');
});

Route::get('users/blogs', function () {
    return view('users/blogs');
});

Route::get('users/blog-detail', function () {
    return view('users/blog-detail');
});

Route::get('users/Date&match', function () {
    return view('users/Date&match');
});

Route::get('users/lock-screen', function () {
    return view('users/lock-screen');
});


Route::get('users/market-place', function () {
    return view('users/market-place');
});

Route::get('users/movies', function () {
    return view('users/movies');
});

Route::get('users/movie-categories', function () {
    return view('users/movie-categories');
});

Route::get('users/movie-single', function () {
    return view('users/movie-single');
});




Route::get('users/events', function () {
    return view('users/events');
});


Route::get('users/create-event', function () {
    return view('users/create-event');
});

Route::get('users/event-detail', function () {
    return view('users/event-detail');
});

Route::get('users/create-new', function () {
    return view('users/create-new');
});



Route::get('users/nearby', function () {
    return view('users/nearby');
});

Route::get('users/settings', function () {
    return view('users/settings');
});


Route::get('users/privacy', function () {
    return view('users/privacy');
});

Route::get('users/product-cart', function () {
    return view('users/product-cart');
});

Route::get('users/product-checkout', function () {
    return view('users/product-checkout');
});

Route::get('users/product-detail', function () {
    return view('users/product-detail');
});

Route::get('users/product-thanks', function () {
    return view('users/product-thanks');
});







Route::get('/admin', function () {
    return view('admin');


});

Route::get('/admin', function () {
    return view('stripe');


});

Route::get('/admin/manage', function () {
    return view('manage');


});

Route::get('/admin/edituser', function () {
    return view('edituser');


});



Auth::routes();


Route::get('/users/', '[email protected]')->name('user'); /*this is authorised pages for login end users */
Route::get('/admin', '[email protected]')->name('admin'); /*used for authorised admin logined admin users */




  Route::resource('admin/users', 'manage\UserController');
  Route::resource('admin/permissions', 'manage\PermissionController', ['except' => 'destroy']);
  Route::resource('admin/roles', 'manage\RoleController', ['except' => 'destroy']);
  Route::resource('admin/posts', 'manage\PostController');


Route::resource('admin/categories', 'CategoriesController');/*for add categories*/







Route::get('admin/change-password', '[email protected]');
Route::post('admin/change-password', '[email protected]')->name('change.password');



Activity icon

Started a new Conversation I Am Getting Error While Using Chatify Package

Route [home] not defined. (View: C:\xampp\htdocs\45\resources\views\vendor\Chatify\pages\app.blade.php)

Sep
30
1 month ago
Activity icon

Replied to I Am Created Custom Registration Form But Getting Error While Registering

    protected function create(array $data)
    {
        $user = User::create([
            'name' => $data['name'],
            'UserName' => $data['UserName'],
            'email' => $data['email'],
            'image' => $data['image'],
            'Age' => $data['Age'],
            'password' => Hash::make($data['password']),
        ]);

         
        $user->attachRole('admin');
        return $user ;
    }
}


is it not correct previous i am using here superadmin but you told me to change it to admin ,,,,,is it correct now if i will use admin ?

Activity icon

Replied to I Am Created Custom Registration Form But Getting Error While Registering

i am not able to understand the question i am very beginner to laravel .... i am created custom signup page and i installed laratrust ...but now problem is like when i am going to sign up ...,database is stored but above mentioned error i am getting .,, i modified the existing laravel signup page.. added more database field there like email,image,UserName,Age,Password

Activity icon

Replied to I Am Created Custom Registration Form But Getting Error While Registering

sir where i have to try this ..User::attachRole() ?

Sep
29
1 month ago
Activity icon

Replied to I Am Created Custom Registration Form But Getting Error While Registering

sir can you please guide me little bit here is user model

<?php

namespace App;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name','UserName', 'email','image','Age', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}


Activity icon

Started a new Conversation I Am Created Custom Registration Form But Getting Error While Registering

BadMethodCallException
Call to undefined method App\User::attachRole()
http://localhost/socialmedialv/public/register 
Illuminate\Database\Eloquent\Model::throwBadMethodCallException
C:\xampp\htdocs\socialmedialv\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:50
Activity icon

Started a new Conversation Facing Error During Db Seeding .


C:\xampp\htdocs\socialmedialv>php artisan db:Seed
Seeding: LaratrustSeeder
Truncating User, Role and Permission tables

   Error

  Class 'Laratrust\Models\LaratrustRole' not found

  at C:\xampp\htdocs\socialmedialv\app\Role.php:7
     3| namespace App;
     4|
     5| use Laratrust\Models\LaratrustRole;
     6|
  >  7| class Role extends LaratrustRole
     8| {
     9|     public $guarded = [];
    10| }
    11|

  1   C:\xampp\htdocs\socialmedialv\vendor\composer\ClassLoader.php:444
      include()

  2   C:\xampp\htdocs\socialmedialv\vendor\composer\ClassLoader.php:322
      Composer\Autoload\includeFile("C:\xampp\htdocs\socialmedialv\vendor\composer/../../app/Role.php")

Sep
28
1 month ago
Activity icon

Replied to Laravel Ui Installation Error

thanks a lot sir thank you so much

Activity icon

Replied to Laravel Ui Installation Error

sir i tried this command but its showing error

Using version ^3.0 for laravel/ui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v7.28.3
    - Conclusion: don't install laravel/framework v7.28.3
    - laravel/ui 3.x-dev requires illuminate/support ^8.0 -> satisfiable by laravel/framework[8.x-dev], illuminate/support[8.x-dev, v8.0.0, v8.0.1, v8.0.2, v8.0.3, v8.0.4, v8.1.0, v8.2.0, v8.3.0, v8.4.0, v8.5.0, v8.6.0].
    - laravel/ui v3.0.0 requires illuminate/support ^8.0 -> satisfiable by laravel/framework[8.x-dev], illuminate/support[8.x-dev, v8.0.0, v8.0.1, v8.0.2, v8.0.3, v8.0.4, v8.1.0, v8.2.0, v8.3.0, v8.4.0, v8.5.0, v8.6.0].
    - Can only install one of: laravel/framework[8.x-dev, v7.28.3].
    - don't install illuminate/support 8.x-dev|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.0.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.0.1|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.0.2|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.0.3|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.0.4|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.1.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.2.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.3.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.4.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.5.0|don't install laravel/framework v7.28.3
    - don't install illuminate/support v8.6.0|don't install laravel/framework v7.28.3
    - Installation request for laravel/framework (locked at v7.28.3, required as ^7.24) -> satisfiable by laravel/framework[v7.28.3].
    - Installation request for laravel/ui ^3.0 -> satisfiable by laravel/ui[3.x-dev, v3.0.0].


Installation failed, reverting ./composer.json to its original content.

Activity icon

Started a new Conversation Laravel Ui Installation Error

  In order to use the Auth::routes() method, please install the laravel/ui package.

  at C:\xampp\htdocs\socialmedialv\vendor\laravel\framework\src\Illuminate\Support\Facades\Auth.php:56
    52|      */
    53|     public static function routes(array $options = [])
    54|     {
    55|         if (! static::$app->providerIsLoaded(UiServiceProvider::class)) {
  > 56|             throw new RuntimeException('In order to use the Auth::routes() method, please install the laravel/ui package.');
    57|         }
    58|
    59|         static::$app->make('router')->auth($options);
    60|     }

  1   C:\xampp\htdocs\socialmedialv\routes\web.php:132
      Illuminate\Support\Facades\Auth::routes()

  2   C:\xampp\htdocs\socialmedialv\vendor\laravel\framework\src\Illuminate\Routing\RouteFileRegistrar.php:35
      require("C:\xampp\htdocs\socialmedialv\routes\web.php")


Aug
25
2 months ago
Activity icon

Replied to In Localmachine Image Upload Is Working And Image Is Displaying But In Hosting Server Image Is Uploaded But Thumbnail Not Displaying Larave 7.2

thank you so much sir ....really appreciate your expertise ,,,Great sir..i found my issue.

Activity icon

Replied to In Localmachine Image Upload Is Working And Image Is Displaying But In Hosting Server Image Is Uploaded But Thumbnail Not Displaying Larave 7.2

correct sir ,,yes sir it is shared hosting....when i am changing image permission 644 to 777 then its visible only when i go through the path..i am using cpanel

Activity icon

Replied to In Localmachine Image Upload Is Working And Image Is Displaying But In Hosting Server Image Is Uploaded But Thumbnail Not Displaying Larave 7.2

there is no error sir....in local machine everything is working....but in server i create prduct and adding image that time image is displaying and uploaded into the folder but after that when i refresh my product panel in admin its showing only thumbnail not image..

when i am clicking over view image ....image path is correct but image is not showing https://www.example.com/ecom/public/storage/media/NbFYjqP4JViGoAHDqCgqaCUoijhBpSCIg4CU8XQO.jpeg

Activity icon

Replied to In Localmachine Image Upload Is Working And Image Is Displaying But In Hosting Server Image Is Uploaded But Thumbnail Not Displaying Larave 7.2

sir i am very new one to it....i guess permission related issue or you told update App_URL IN env ....APP_URL=https://www.example.com/ecom/public

url is same as its on local machine and in server

Activity icon

Started a new Conversation In Localmachine Image Upload Is Working And Image Is Displaying But In Hosting Server Image Is Uploaded But Thumbnail Not Displaying Larave 7.2

i am using laravel 7.2 . i uploaded it on server .issue is that images are not visible ,image is uploading proper in public/storage/media ...but not displaying in admin panel but in my computer local machine its working proper can you please help me out to provide best solution ?

Aug
09
3 months ago
Activity icon

Replied to Bootstrapvue Is Not Working Bootstrap-vue Doesn't Load Css And Js So Page Is Not Responsive ...

sir can you please provide me solution for this ....i am beginner to bootstrapVue ....i want to this page functioning proper how can i do that...... i am imported adminlte 3 panel adding on this page by using @include(admin.dashboard).

Activity icon

Replied to Bootstrapvue Is Not Working Bootstrap-vue Doesn't Load Css And Js So Page Is Not Responsive ...

sir here are the two script i am trying to add but its not working ...i also tried to add cdn but problem still same..

@include('admin.dashboard')

<script src="{{asset('js/app.js')}}" type="text/javascript"></script>
<link href="{{asset('css/app.css')}}" rel="stylesheet" type="text/css">

Activity icon

Started a new Conversation Bootstrapvue Is Not Working Bootstrap-vue Doesn't Load Css And Js So Page Is Not Responsive ...

@include('admin.dashboard')
 <div class="flex-container">
    <div class="columns m-t-10">
      <div class="column">
        
      </div>
    </div>
    <hr class="m-t-0">

    <div class="columns">
      <div class="column">
        <form action="{{route('permissions.store')}}" method="POST">
          {{csrf_field()}}

          <div class="block">
                <b-radio v-model="permissionType" name="permission_type" native-value="basic">Basic Permission</b-radio>
                <b-radio v-model="permissionType" name="permission_type" native-value="crud">CRUD Permission</b-radio>
          </div>

          <div class="field" v-if="permissionType == 'basic'">
            <label for="display_name" class="label">Name (Display Name)</label>
            <p class="control">
              <input type="text" class="input" name="display_name" id="display_name">
            </p>
          </div>

          <div class="field" v-if="permissionType == 'basic'">
            <label for="name" class="label">Slug</label>
            <p class="control">
              <input type="text" class="input" name="name" id="name">
            </p>
          </div>

          <div class="field" v-if="permissionType == 'basic'">
            <label for="description" class="label">Description</label>
            <p class="control">
              <input type="text" class="input" name="description" id="description" placeholder="Describe what this permission does">
            </p>
          </div>

          <div class="field" v-if="permissionType == 'crud'">
            <label for="resource" class="label">Resource</label>
            <p class="control">
              <input type="text" class="input" name="resource" id="resource" v-model="resource" placeholder="The name of the resource">
            </p>
          </div>

          <div class="columns" v-if="permissionType == 'crud'">
            <div class="column is-one-quarter">
                <div class="field">
                  <b-checkbox v-model="crudSelected" native-value="create">Create</b-checkbox>
                </div>
                <div class="field">
                  <b-checkbox v-model="crudSelected" v-model="crudSelected" native-value="read">Read</b-checkbox>
                </div>
                <div class="field">
                  <b-checkbox v-model="crudSelected" native-value="update">Update</b-checkbox>
                </div>
                <div class="field">
                  <b-checkbox v-model="crudSelected" native-value="delete">Delete</b-checkbox>
                </div>
            </div> <!-- end of .column -->

            <input type="hidden" name="crud_selected" :value="crudSelected">

            <div class="column">
              <table class="table" v-if="resource.length >= 3 && crudSelected.length > 0">
                <thead>
                  <th>Name</th>
                  <th>Slug</th>
                  <th>Description</th>
                </thead>
                <tbody>
                  <tr v-for="item in crudSelected">
                    <td v-text="crudName(item)"></td>
                    <td v-text="crudSlug(item)"></td>
                    <td v-text="crudDescription(item)"></td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>

          <button class="button is-success">Create Permission</button>
        </form>
      </div>
    </div>

  </div> <!-- end of .flex-container -->


  <script>

    var app = new Vue({
      el: '#app',
      data: {
        permissionType: 'basic',
        resource: '',
        crudSelected: ['create', 'read', 'update', 'delete']
      },
      methods: {
        crudName: function(item) {
          return item.substr(0,1).toUpperCase() + item.substr(1) + " " + app.resource.substr(0,1).toUpperCase() + app.resource.substr(1);
        },
        crudSlug: function(item) {
          return item.toLowerCase() + "-" + app.resource.toLowerCase();
        },
        crudDescription: function(item) {
          return "Allow a User to " + item.toUpperCase() + " a " + app.resource.substr(0,1).toUpperCase() + app.resource.substr(1);
        }
      }
    });
  </script>



Aug
08
3 months ago
Activity icon

Started a new Conversation User Roles Are Fetching In Create User Form But Not Adding User Role In Database

    <!-- /.content-header -->
  <div class="container">
    <div class="columns m-t-10">
      <div class="column">
      </div>
    </div>
    <hr class="m-t-0">
    <form action="{{route('users.store')}}" method="POST">
      {{csrf_field()}}
      <div class="columns">
        <div class="column">
          <div>
            <label for="name" class="label">Name</label>
              <input type="text" class="input" name="name" id="name">
            
          </div>

          <div>
            <label for="email" class="label">Email:</label>
              <input type="text" class="input" name="email" id="email">
          </div>
          <div >
            <label for="password" class="label">Password</label>
              <input type="text" class="input" name="password" id="password" placeholder="enter password">
              
            </p>
          </div>
        </div> <!-- end of .column -->

        <div class="column">
          <label for="roles" class="label">Roles:</label>
       

            @foreach ($roles as $role)
              <div class="field">
              <label><input type="checkbox" value="{{$role->id}}">   {{$role->display_name}} </label>
              </div>
            @endforeach
        </div>

      </div> <!-- end of .columns for forms -->
      <div class="columns">
        <div class="column">
          <hr />
          <button class="btn btn-primary" style="width: 250px;">Create New User</button>
        </div>
      </div>
    </form>
  </div> <!-- end of .flex-container -->







/*my controller is here */
<?php

namespace App\Http\Controllers\manage;
use App\Http\Controllers\Controller;

use Illuminate\Http\Request;
use App\User;
use App\Role;
use DB;
use Session;
use Hash;
use Input;

class UserController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
      $users = User::orderBy('id', 'desc')->paginate(10);
      return view('manage.users.index')->withUsers($users);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
      $roles = Role::all();
      return view('manage.users.create')->withRoles($roles);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
      $this->validateWith([
        'name' => 'required|max:255',
        'email' => 'required|email|unique:users'
      ]);

      if (!empty($request->password)) {
        $password = trim($request->password);
      } else {
        # set the manual password
        $length = 10;
        $keyspace = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
        $str = '';
        $max = mb_strlen($keyspace, '8bit') - 1;
        for ($i = 0; $i < $length; ++$i) {
            $str .= $keyspace[random_int(0, $max)];
        }
        $password = $str;
      }

      $user = new User();
      $user->name = $request->name;
      $user->email = $request->email;
      $user->password = Hash::make($password);
      $user->save();

      if ($request->roles) {
        $user->syncRoles(explode(',', $request->roles));
      }

      return redirect()->route('users.show', $user->id);

      // if () {
      //
      // } else {
      //   Session::flash('danger', 'Sorry a problem occurred while creating this user.');
      //   return redirect()->route('users.create');
      // }
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
      $user = User::where('id', $id)->with('roles')->first();
      return view("manage.users.show")->withUser($user);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
      $roles = Role::all();
      $user = User::where('id', $id)->with('roles')->first();
      return view("manage.users.edit")->withUser($user)->withRoles($roles);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
      $this->validateWith([
        'name' => 'required|max:255',
        'email' => 'required|email|unique:users,email,'.$id
      ]);

      $user = User::findOrFail($id);
      $user->name = $request->name;
      $user->email = $request->email;
      if ($request->password_options == 'auto') {
        $length = 10;
        $keyspace = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
        $str = '';
        $max = mb_strlen($keyspace, '8bit') - 1;
        for ($i = 0; $i < $length; ++$i) {
            $str .= $keyspace[random_int(0, $max)];
        }
        $user->password = Hash::make($str);
      } elseif ($request->password_options == 'manual') {
        $user->password = Hash::make($request->password);
      }
      $user->save();

      $user->syncRoles(explode(',', $request->roles));
      return redirect()->route('users.show', $id);

      // if () {
      //   return redirect()->route('users.show', $id);
      // } else {
      //   Session::flash('error', 'There was a problem saving the updated user info to the database. Try again later.');
      //   return redirect()->route('users.edit', $id);
      // }
    }

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





Activity icon

Started a new Conversation How To Convert Vue Bootstrap To Normal Bootstrap.

          <div class="field">
            <label for="password" class="label">Password</label>
            <b-radio-group v-model="password_options">
              <div class="field">
                <b-radio name="password_options" value="keep">Do Not Change Password</b-radio>
              </div>
              <div class="field">
                <b-radio name="password_options" value="auto">Auto-Generate New Password</b-radio>
              </div>
              <div class="field">
                <b-radio name="password_options" value="manual">Manually Set New Password</b-radio>
                <p class="control">
                  <input type="text" class="input" name="password" id="password" v-if="password_options == 'manual'" placeholder="Manually give a password to this user">
                </p>
              </div>
            </b-radio-group>
          </div>
        </div> <!-- end of .column -->

        <div class="column">
          <label for="roles" class="label">Roles:</label>
          <input type="hidden" name="roles" :value="rolesSelected" />

            @foreach ($roles as $role)
              <div class="field">
                <b-checkbox v-model="rolesSelected" :native-value="{{$role->id}}">{{$role->display_name}}</b-checkbox>
              </div>
            @endforeach
        </div>
      </div>
      <div class="columns">
        <div class="column">
          <hr />
          <button class="button is-primary is-pulled-right" style="width: 250px;">Edit User</button>
        </div>
      </div>
    </form>

  </div> <!-- end of .flex-container -->




  <script>

    var app = new Vue({
      el: '#app',
      data: {
        password_options: 'keep',
        rolesSelected: {!! $user->roles->pluck('id') !!}
      }
    });

  </script>


Aug
05
3 months ago
Activity icon

Replied to Update Function Is Not Working Token Is Generated

madam can you please provide me code for manage users ,create update,delete,and manage their role permission , i was installed laratrust..above code i tried to update its mesh all things i created...i was following a youtube video for this ...but i guess something is missing on form action ...madam please analyse code once ..

Activity icon

Replied to Update Function Is Not Working Token Is Generated

i update as you want still same not working...

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

thank you so much madam , thanks a lot lot....i am obliged .... i was trying to fix this issue from 4 days and almost 4 days wasted behind it ...thank you again and thanks for your valuable efforts and kindness...

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

@extends('layouts.app')

@section('pageTitle', 'Edit Categories Details')

@section('content')

    <h1 class="display-6">Edit Categories</h1>

    <hr/>
    <!-- if validation in the controller fails, show the errors -->
    @if ($errors->any())
        <div class="alert alert-danger">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

 

<form action="{{ route('categories.update', ['category' => $category]) }}" method="POST">
     @csrf

     @method('PUT')

    <!-- inputs without id -->
</form>




              <label for="id">ID:</label>
              <input type="text" class="form-control" value="{{$category->id}}" name="id"/>
          </div>
          <div class="form-group">
              <label for="name">Name :</label>
              <input type="text" class="form-control" value="{{$category->name}}" name="name"/>
          </div>
          <div class="form-group">
              <label for="status">status</label>
              <input type="text" class="form-control" value="{{$category->status}}"  name="status"  />
          </div>
         
          <button type="submit" class="btn btn-primary">UPDATE</button>
      </form>
@endsection

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

madam i made all the changes but now update button is not working.....its not functioning mean neither refreshing page nor updating its stuck continue on update page....

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

okay thanks madam let me check this..

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

no sir i am confused ...sir can u please guide me what steps should i need follow .. can you please provide code for like i have categories table in database there are three column id name and status ....i want to perform create,update, and delete but only create and delete is working ...i will be more obliged ..

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

sir i try that not working ...its showing Symfony\Component\Debug\Exception\FatalThrowableError syntax error, unexpected '$categories' (T_VARIABLE)

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

madam should i need to change categories model to category ....why ?? i want to update id ...means i created a table inside database which name is categories so there are three column inside category id,name,status...i want when user update something so it will change according to selected id ... example id 1 is selected for update so it will update data of id 1 like name and status...

Activity icon

Started a new Conversation Update Function Is Not Working Token Is Generated

Route::post('admin/update/{id}','[email protected]');/*used for update the data receive from edit */
Route::get('admin/manage/deleteuser/{id}','[email protected]');


here is controller 
public function update(Request $request, $id) 
    
    {   

        $name=$request->input('name');

        $email=$request->input('email');

       DB::update('update users set name=?,email=? where id= ?',[$name,$email]);
       
        return redirect('admin.manage')->with('sucess','Data Updated') ; 
    } 


here is the view

 @foreach($users as $row[0])

    
          <form  action="/update/{{$row[0]->id}}" method="POST">

            {{csrf_field()}}
  <div class="form-group">
    <label >User Name</label>
    <input type="text" class="form-control" name="name"  value= "{{$row[0]->name}}" >
    <small id="textHelp" class="form-text text-muted">Please re-enter the Name you want to change</small>
  </div>
  <div class="form-group">
    <label >Email</label>
    <input type="email" class="form-control" name="email" value= "{{$row[0]->email}}">
    <small id="emailHelp" class="form-text text-muted">Please re-enter the Email you want to change</small>
  </div>
 
  <button type="submit" class="btn btn-primary">Update Data</button>

</form>

Activity icon

Replied to Update Function Is Not Working Laravel 6 I Am Using Resource Controller

form method="PUT" action= "{{ action('[email protected]',$categories->id) }}

Activity icon

Started a new Conversation Update Function Is Not Working Laravel 6 I Am Using Resource Controller

/* here is the controller */ public function update(Request $request, $id) {

    $categories = Categories::findOrFail($id);

    $this->validate($request, [
        'id' => 'required',
        'name' => 'required',
        'status' => 'required',
       
    ]);

    $input = $request->all();

    $categories->fill($input)->save();

    return redirect()->route('categories.index');
}

/*here is the form */

          <label for="id">ID:</label>
          <input type="text" class="form-control" value="{{$categories->id}}" name="id"/>
      </div>
      <div class="form-group">
          <label for="name">Name :</label>
          <input type="text" class="form-control" value="{{$categories->name}}" name="name"/>
      </div>
      <div class="form-group">
          <label for="status">status</label>
          <input type="text" class="form-control" value="{{$categories->status}}"  name="status"  />
      </div>
     
      <button type="submit" class="btn btn-primary">UPDATE</button>
  </form>